##// END OF EJS Templates
Added os.sep in models for better win support...
marcink -
r1199:268fa0b6 beta
parent child Browse files
Show More
@@ -48,20 +48,23 b' def generate_api_key(username, salt=None'
48
48
49 return hashlib.sha1(username + salt).hexdigest()
49 return hashlib.sha1(username + salt).hexdigest()
50
50
51 def safe_unicode(str):
51 def safe_unicode(_str):
52 """
52 """
53 safe unicode function. In case of UnicodeDecode error we try to return
53 safe unicode function. In case of UnicodeDecode error we try to return
54 unicode with errors replace, if this fails we return unicode with
54 unicode with errors replace, if this fails we return unicode with
55 string_escape decoding
55 string_escape decoding
56 """
56 """
57
57
58 if isinstance(_str, unicode):
59 return _str
60
58 try:
61 try:
59 u_str = unicode(str)
62 u_str = unicode(_str)
60 except UnicodeDecodeError:
63 except UnicodeDecodeError:
61 try:
64 try:
62 u_str = unicode(str, 'utf-8', 'replace')
65 u_str = _str.decode('utf-8', 'replace')
63 except UnicodeDecodeError:
66 except UnicodeDecodeError:
64 #incase we have a decode error just represent as byte string
67 #incase we have a decode error just represent as byte string
65 u_str = unicode(str(str).encode('string_escape'))
68 u_str = unicode(_str.encode('string_escape'))
66
69
67 return u_str
70 return u_str
@@ -24,6 +24,8 b''
24 # along with this program; if not, write to the Free Software
24 # along with this program; if not, write to the Free Software
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
25 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
26 # MA 02110-1301, USA.
26 # MA 02110-1301, USA.
27
28 import os
27 import logging
29 import logging
28 import datetime
30 import datetime
29 from datetime import date
31 from datetime import date
@@ -212,7 +214,7 b' class Repository(Base):'
212
214
213 @property
215 @property
214 def just_name(self):
216 def just_name(self):
215 return self.repo_name.split('/')[-1]
217 return self.repo_name.split(os.sep)[-1]
216
218
217 @property
219 @property
218 def groups_with_parents(self):
220 def groups_with_parents(self):
General Comments 0
You need to be logged in to leave comments. Login now