##// END OF EJS Templates
py3: some not-entirely-trivial removing of "unicode"
Mads Kiilerich -
r8080:f9988201 default
parent child Browse files
Show More
@@ -60,7 +60,7 b' def _journal_filter(user_log, search_ter'
60 if search_term:
60 if search_term:
61 qp = QueryParser('repository', schema=JOURNAL_SCHEMA)
61 qp = QueryParser('repository', schema=JOURNAL_SCHEMA)
62 qp.add_plugin(DateParserPlugin())
62 qp.add_plugin(DateParserPlugin())
63 qry = qp.parse(unicode(search_term))
63 qry = qp.parse(search_term)
64 log.debug('Filtering using parsed query %r', qry)
64 log.debug('Filtering using parsed query %r', qry)
65
65
66 def wildcard_handler(col, wc_term):
66 def wildcard_handler(col, wc_term):
@@ -96,7 +96,7 b' class SearchController(BaseRepoControlle'
96 # for case-sensitive matching
96 # for case-sensitive matching
97 cur_query = u'repository_rawname:%s %s' % (c.repo_name, cur_query)
97 cur_query = u'repository_rawname:%s %s' % (c.repo_name, cur_query)
98 try:
98 try:
99 query = qp.parse(unicode(cur_query))
99 query = qp.parse(cur_query)
100 # extract words for highlight
100 # extract words for highlight
101 if isinstance(query, Phrase):
101 if isinstance(query, Phrase):
102 highlight_items.update(query.words)
102 highlight_items.update(query.words)
@@ -274,7 +274,7 b' class GitRepository(BaseRepository):'
274 msg = "Revision %r does not exist for %s" % (revision, self.name)
274 msg = "Revision %r does not exist for %s" % (revision, self.name)
275 raise ChangesetDoesNotExistError(msg)
275 raise ChangesetDoesNotExistError(msg)
276
276
277 if isinstance(revision, (str, unicode)):
277 if isinstance(revision, str):
278 if revision.isdigit() and (len(revision) < 12 or len(revision) == revision.count('0')):
278 if revision.isdigit() and (len(revision) < 12 or len(revision) == revision.count('0')):
279 try:
279 try:
280 return self.revisions[int(revision)]
280 return self.revisions[int(revision)]
@@ -30,12 +30,12 b' class MercurialInMemoryChangeset(BaseInM'
30 """
30 """
31 self.check_integrity(parents)
31 self.check_integrity(parents)
32
32
33 if not isinstance(message, str):
34 raise RepositoryError('message must be a str - got %r' % type(message))
35 if not isinstance(author, str):
36 raise RepositoryError('author must be a str - got %r' % type(author))
37
33 from .repository import MercurialRepository
38 from .repository import MercurialRepository
34 if not isinstance(message, unicode) or not isinstance(author, unicode):
35 raise RepositoryError('Given message and author needs to be '
36 'an <unicode> instance got %r & %r instead'
37 % (type(message), type(author)))
38
39 if branch is None:
39 if branch is None:
40 branch = MercurialRepository.DEFAULT_BRANCH_NAME
40 branch = MercurialRepository.DEFAULT_BRANCH_NAME
41 kwargs[b'branch'] = safe_bytes(branch)
41 kwargs[b'branch'] = safe_bytes(branch)
@@ -218,9 +218,7 b' class Setting(Base, BaseDbModel):'
218 @app_settings_value.setter
218 @app_settings_value.setter
219 def app_settings_value(self, val):
219 def app_settings_value(self, val):
220 """
220 """
221 Setter that will always make sure we use unicode in app_settings_value
221 Setter that will always make sure we use str in app_settings_value
222
223 :param val:
224 """
222 """
225 self._app_settings_value = safe_str(val)
223 self._app_settings_value = safe_str(val)
226
224
@@ -51,7 +51,7 b' def sortkey(x):'
51 * first contribution
51 * first contribution
52 * number of contribution years
52 * number of contribution years
53 * name (with some unicode normalization)
53 * name (with some unicode normalization)
54 The entries must be 2-tuples of a list of string years and the unicode name"""
54 The entries must be 2-tuples of a list of string years and the name"""
55 return (x[0] and -int(x[0][-1]),
55 return (x[0] and -int(x[0][-1]),
56 x[0] and int(x[0][0]),
56 x[0] and int(x[0][0]),
57 -len(x[0]),
57 -len(x[0]),
General Comments 0
You need to be logged in to leave comments. Login now