##// END OF EJS Templates
fixed possible unicode errors on repo get function
marcink -
r2672:16980771 beta
parent child Browse files
Show More
@@ -43,6 +43,7
43 43
44 44 import logging
45 45 from rhodecode.model import meta
46 from rhodecode.lib.utils2 import safe_str
46 47
47 48 log = logging.getLogger(__name__)
48 49
@@ -86,7 +87,7 class BaseModel(object):
86 87
87 88 if isinstance(instance, cls):
88 89 return instance
89 elif isinstance(instance, (int, long)) or str(instance).isdigit():
90 elif isinstance(instance, (int, long)) or safe_str(instance).isdigit():
90 91 return cls.get(instance)
91 92 else:
92 93 if instance:
@@ -186,7 +186,7 class ScmModel(BaseModel):
186 186 cls = Repository
187 187 if isinstance(instance, cls):
188 188 return instance
189 elif isinstance(instance, int) or str(instance).isdigit():
189 elif isinstance(instance, int) or safe_str(instance).isdigit():
190 190 return cls.get(instance)
191 191 elif isinstance(instance, basestring):
192 192 return cls.get_by_repo_name(instance)
@@ -592,4 +592,4 class ScmModel(BaseModel):
592 592 f.write(tmpl)
593 593 os.chmod(_hook_file, 0755)
594 594 else:
595 log.debug('skipping writing hook file') No newline at end of file
595 log.debug('skipping writing hook file')
General Comments 0
You need to be logged in to leave comments. Login now