##// 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 import logging
44 import logging
45 from rhodecode.model import meta
45 from rhodecode.model import meta
46 from rhodecode.lib.utils2 import safe_str
46
47
47 log = logging.getLogger(__name__)
48 log = logging.getLogger(__name__)
48
49
@@ -86,7 +87,7 class BaseModel(object):
86
87
87 if isinstance(instance, cls):
88 if isinstance(instance, cls):
88 return instance
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 return cls.get(instance)
91 return cls.get(instance)
91 else:
92 else:
92 if instance:
93 if instance:
@@ -186,7 +186,7 class ScmModel(BaseModel):
186 cls = Repository
186 cls = Repository
187 if isinstance(instance, cls):
187 if isinstance(instance, cls):
188 return instance
188 return instance
189 elif isinstance(instance, int) or str(instance).isdigit():
189 elif isinstance(instance, int) or safe_str(instance).isdigit():
190 return cls.get(instance)
190 return cls.get(instance)
191 elif isinstance(instance, basestring):
191 elif isinstance(instance, basestring):
192 return cls.get_by_repo_name(instance)
192 return cls.get_by_repo_name(instance)
@@ -592,4 +592,4 class ScmModel(BaseModel):
592 f.write(tmpl)
592 f.write(tmpl)
593 os.chmod(_hook_file, 0755)
593 os.chmod(_hook_file, 0755)
594 else:
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