##// END OF EJS Templates
FOLD: into unicode changes
super-admin -
r4959:00826968 default
parent child Browse files
Show More
@@ -1346,7 +1346,7 b' class AuthUser(object):'
1346 1346 def _cached_repo_acl(perm_def, _name_filter):
1347 1347 qry = Repository.query()
1348 1348 if _name_filter:
1349 ilike_expression = u'%{}%'.format(safe_unicode(_name_filter))
1349 ilike_expression = '%{}%'.format(_name_filter)
1350 1350 qry = qry.filter(
1351 1351 Repository.repo_name.ilike(ilike_expression))
1352 1352
@@ -1397,7 +1397,7 b' class AuthUser(object):'
1397 1397 def _cached_repo_group_acl(perm_def, _name_filter):
1398 1398 qry = RepoGroup.query()
1399 1399 if _name_filter:
1400 ilike_expression = u'%{}%'.format(safe_unicode(_name_filter))
1400 ilike_expression = '%{}%'.format(_name_filter)
1401 1401 qry = qry.filter(
1402 1402 RepoGroup.group_name.ilike(ilike_expression))
1403 1403
@@ -1446,7 +1446,7 b' class AuthUser(object):'
1446 1446 def _cached_user_group_acl(perm_def, _name_filter):
1447 1447 qry = UserGroup.query()
1448 1448 if _name_filter:
1449 ilike_expression = u'%{}%'.format(safe_unicode(_name_filter))
1449 ilike_expression = '%{}%'.format(_name_filter)
1450 1450 qry = qry.filter(
1451 1451 UserGroup.users_group_name.ilike(ilike_expression))
1452 1452
@@ -2323,9 +2323,11 b' class HasPermissionAnyMiddleware(object)'
2323 2323 self.required_perms = set(perms)
2324 2324
2325 2325 def __call__(self, auth_user, repo_name):
2326 # repo_name MUST be unicode, since we handle keys in permission
2327 # dict by unicode
2328 repo_name = safe_unicode(repo_name)
2326 # # repo_name MUST be unicode, since we handle keys in permission
2327 # # dict by unicode
2328 #TODO: verify
2329 # repo_name = safe_unicode(repo_name)
2330
2329 2331 log.debug(
2330 2332 'Checking VCS protocol permissions %s for user:%s repo:`%s`',
2331 2333 self.required_perms, auth_user, repo_name)
@@ -2495,10 +2497,11 b' def check_ip_access(source_ip, allowed_i'
2495 2497 :param allowed_ips: list of allowed ips together with mask
2496 2498 """
2497 2499 log.debug('checking if ip:%s is subnet of %s', source_ip, allowed_ips)
2498 source_ip_address = ipaddress.ip_address(safe_unicode(source_ip))
2500 source_ip_address = ipaddress.ip_address(source_ip)
2499 2501 if isinstance(allowed_ips, (tuple, list, set)):
2500 2502 for ip in allowed_ips:
2501 ip = safe_unicode(ip)
2503 #TODO: verify
2504 #ip = safe_unicode(ip)
2502 2505 try:
2503 2506 network_address = ipaddress.ip_network(ip, strict=False)
2504 2507 if source_ip_address in network_address:
@@ -86,7 +86,7 b' def _filter_port(ip):'
86 86 else:
87 87 # fallback to ipaddress
88 88 try:
89 ipaddress.IPv6Address(safe_unicode(ip_addr))
89 ipaddress.IPv6Address(safe_str(ip_addr))
90 90 except Exception:
91 91 return False
92 92 return True
@@ -1086,7 +1086,7 b' def style_metatag(tag_type, value):'
1086 1086 pat, replace_html = tag_data
1087 1087 # convert to plain `unicode` instead of a markup tag to be used in
1088 1088 # regex expressions. safe_unicode doesn't work here
1089 html_value = pat.sub(replace_html, unicode(value))
1089 html_value = pat.sub(replace_html, value)
1090 1090
1091 1091 return html_value
1092 1092
@@ -1223,10 +1223,10 b' class InitialsGravatar(object):'
1223 1223 def normalize_email(self, email_address):
1224 1224 import unicodedata
1225 1225 # default host used to fill in the fake/missing email
1226 default_host = u'localhost'
1226 default_host = 'localhost'
1227 1227
1228 1228 if not email_address:
1229 email_address = u'%s@%s' % (User.DEFAULT_USER, default_host)
1229 email_address = '%s@%s' % (User.DEFAULT_USER, default_host)
1230 1230
1231 1231 email_address = safe_unicode(email_address)
1232 1232
@@ -467,8 +467,9 b' class MercurialRepository(BaseRepository'
467 467 else:
468 468 commit_id = "tip"
469 469
470 if isinstance(commit_id, unicode):
471 commit_id = safe_str(commit_id)
470 #TODO: decide if we pass bytes or str into lookup ?
471 # if isinstance(commit_id, unicode):
472 # commit_id = safe_str(commit_id)
472 473
473 474 try:
474 475 raw_id, idx = self._remote.lookup(commit_id, both=True)
@@ -47,10 +47,10 b' class NodeKind:'
47 47
48 48
49 49 class NodeState:
50 ADDED = u'added'
51 CHANGED = u'changed'
52 NOT_CHANGED = u'not changed'
53 REMOVED = u'removed'
50 ADDED = 'added'
51 CHANGED = 'changed'
52 NOT_CHANGED = 'not changed'
53 REMOVED = 'removed'
54 54
55 55
56 56 class NodeGeneratorBase(object):
@@ -115,7 +115,7 b' class Node(object):'
115 115 only. Moreover, every single node is identified by the ``path`` attribute,
116 116 so it cannot end with slash, too. Otherwise, path could lead to mistakes.
117 117 """
118 RTLO_MARKER = u"\u202E" # RTLO marker allows swapping text, and certain
118 RTLO_MARKER = "\u202E" # RTLO marker allows swapping text, and certain
119 119 # security attacks could be used with this
120 120 commit = None
121 121
@@ -173,7 +173,7 b' class Node(object):'
173 173 _parts = self.path.rstrip('/').rsplit('/', 1)
174 174 if len(_parts) == 2:
175 175 return safe_unicode(_parts[0])
176 return u''
176 return ''
177 177
178 178 @LazyProperty
179 179 def name(self):
@@ -829,7 +829,7 b' class SubModuleNode(Node):'
829 829 then only last part is returned.
830 830 """
831 831 org = safe_unicode(self.path.rstrip('/').split('/')[-1])
832 return u'%s @ %s' % (org, self.commit.short_id)
832 return '%s @ %s' % (org, self.commit.short_id)
833 833
834 834
835 835 class LargeFileNode(FileNode):
@@ -346,7 +346,7 b' class RhodeCodeSetting(Base, BaseModel):'
346 346
347 347 @validates('_app_settings_value')
348 348 def validate_settings_value(self, key, val):
349 assert type(val) == unicode
349 assert type(val) == str
350 350 return val
351 351
352 352 @hybrid_property
@@ -487,7 +487,7 b' class RepoRhodeCodeSetting(Base, BaseMod'
487 487
488 488 @validates('_app_settings_value')
489 489 def validate_settings_value(self, key, val):
490 assert type(val) == unicode
490 assert type(val) == str
491 491 return val
492 492
493 493 @hybrid_property
General Comments 0
You need to be logged in to leave comments. Login now