##// END OF EJS Templates
hgweb: replace some str.split() calls by str.partition() or str.rpartition()...
av6 -
r26846:7c1b4840 default
parent child Browse files
Show More
@@ -304,8 +304,8 b' class hgweb(object):'
304 parts = parts[len(repo_parts):]
304 parts = parts[len(repo_parts):]
305 query = '/'.join(parts)
305 query = '/'.join(parts)
306 else:
306 else:
307 query = req.env['QUERY_STRING'].split('&', 1)[0]
307 query = req.env['QUERY_STRING'].partition('&')[0]
308 query = query.split(';', 1)[0]
308 query = query.partition(';')[0]
309
309
310 # process this if it's a protocol request
310 # process this if it's a protocol request
311 # protocol bits don't need to create any URLs
311 # protocol bits don't need to create any URLs
@@ -80,7 +80,7 b' class wsgirequest(object):'
80 if self._start_response is not None:
80 if self._start_response is not None:
81 self.headers.append(('Content-Type', type))
81 self.headers.append(('Content-Type', type))
82 if filename:
82 if filename:
83 filename = (filename.split('/')[-1]
83 filename = (filename.rpartition('/')[-1]
84 .replace('\\', '\\\\').replace('"', '\\"'))
84 .replace('\\', '\\\\').replace('"', '\\"'))
85 self.headers.append(('Content-Disposition',
85 self.headers.append(('Content-Disposition',
86 'inline; filename="%s"' % filename))
86 'inline; filename="%s"' % filename))
@@ -1248,7 +1248,7 b' def graph(web, req, tmpl):'
1248 def _getdoc(e):
1248 def _getdoc(e):
1249 doc = e[0].__doc__
1249 doc = e[0].__doc__
1250 if doc:
1250 if doc:
1251 doc = _(doc).split('\n')[0]
1251 doc = _(doc).partition('\n')[0]
1252 else:
1252 else:
1253 doc = _('(no help text available)')
1253 doc = _('(no help text available)')
1254 return doc
1254 return doc
@@ -1278,7 +1278,7 b' def help(web, req, tmpl):'
1278 yield {'topic': entries[0], 'summary': summary}
1278 yield {'topic': entries[0], 'summary': summary}
1279
1279
1280 early, other = [], []
1280 early, other = [], []
1281 primary = lambda s: s.split('|')[0]
1281 primary = lambda s: s.partition('|')[0]
1282 for c, e in commands.table.iteritems():
1282 for c, e in commands.table.iteritems():
1283 doc = _getdoc(e)
1283 doc = _getdoc(e)
1284 if 'DEPRECATED' in doc or c.startswith('debug'):
1284 if 'DEPRECATED' in doc or c.startswith('debug'):
General Comments 0
You need to be logged in to leave comments. Login now