##// END OF EJS Templates
constants: use correct unicode encoding - avoid extra conversions
Mads Kiilerich -
r5610:330c671d default
parent child Browse files
Show More
@@ -522,7 +522,7 b' class DbManage(object):'
522 def create_user(self, username, password, email='', admin=False):
522 def create_user(self, username, password, email='', admin=False):
523 log.info('creating user %s', username)
523 log.info('creating user %s', username)
524 UserModel().create_or_update(username, password, email,
524 UserModel().create_or_update(username, password, email,
525 firstname='Kallithea', lastname='Admin',
525 firstname=u'Kallithea', lastname=u'Admin',
526 active=True, admin=admin,
526 active=True, admin=admin,
527 extern_type=EXTERN_TYPE_INTERNAL)
527 extern_type=EXTERN_TYPE_INTERNAL)
528
528
@@ -532,8 +532,8 b' class DbManage(object):'
532 user = UserModel().create_or_update(username=User.DEFAULT_USER,
532 user = UserModel().create_or_update(username=User.DEFAULT_USER,
533 password=str(uuid.uuid1())[:20],
533 password=str(uuid.uuid1())[:20],
534 email='anonymous@kallithea-scm.org',
534 email='anonymous@kallithea-scm.org',
535 firstname='Anonymous',
535 firstname=u'Anonymous',
536 lastname='User')
536 lastname=u'User')
537 # based on configuration options activate/deactivate this user which
537 # based on configuration options activate/deactivate this user which
538 # controls anonymous access
538 # controls anonymous access
539 if self.cli_args.get('public_access') is False:
539 if self.cli_args.get('public_access') is False:
@@ -186,7 +186,7 b' def action_logger(user, action, repo, ip'
186 repo_obj = Repository.get_by_repo_name(repo_name)
186 repo_obj = Repository.get_by_repo_name(repo_name)
187 else:
187 else:
188 repo_obj = None
188 repo_obj = None
189 repo_name = ''
189 repo_name = u''
190
190
191 user_log = UserLog()
191 user_log = UserLog()
192 user_log.user_id = user_obj.user_id
192 user_log.user_id = user_obj.user_id
@@ -451,7 +451,7 b' def map_groups(path):'
451 rgm = RepoGroupModel(sa)
451 rgm = RepoGroupModel(sa)
452 owner = User.get_first_admin()
452 owner = User.get_first_admin()
453 for lvl, group_name in enumerate(groups):
453 for lvl, group_name in enumerate(groups):
454 group_name = '/'.join(groups[:lvl] + [group_name])
454 group_name = u'/'.join(groups[:lvl] + [group_name])
455 group = RepoGroup.get_by_group_name(group_name)
455 group = RepoGroup.get_by_group_name(group_name)
456 desc = '%s group' % group_name
456 desc = '%s group' % group_name
457
457
@@ -100,8 +100,8 b' class UserModel(BaseModel):'
100 log_create_user(new_user.get_dict(), cur_user)
100 log_create_user(new_user.get_dict(), cur_user)
101 return new_user
101 return new_user
102
102
103 def create_or_update(self, username, password, email, firstname='',
103 def create_or_update(self, username, password, email, firstname=u'',
104 lastname='', active=True, admin=False,
104 lastname=u'', active=True, admin=False,
105 extern_type=None, extern_name=None, cur_user=None):
105 extern_type=None, extern_name=None, cur_user=None):
106 """
106 """
107 Creates a new instance if not found, or updates current one
107 Creates a new instance if not found, or updates current one
@@ -191,7 +191,7 b' class UserModel(BaseModel):'
191 # notification to admins
191 # notification to admins
192 subject = _('New user registration')
192 subject = _('New user registration')
193 body = (
193 body = (
194 'New user registration\n'
194 u'New user registration\n'
195 '---------------------\n'
195 '---------------------\n'
196 '- Username: {user.username}\n'
196 '- Username: {user.username}\n'
197 '- Full Name: {user.full_name}\n'
197 '- Full Name: {user.full_name}\n'
@@ -375,7 +375,7 b' class UserGroupModel(BaseModel):'
375 for gr in set(groups):
375 for gr in set(groups):
376 existing_group = UserGroup.get_by_group_name(gr)
376 existing_group = UserGroup.get_by_group_name(gr)
377 if not existing_group:
377 if not existing_group:
378 desc = 'Automatically created from plugin:%s' % extern_type
378 desc = u'Automatically created from plugin:%s' % extern_type
379 # we use first admin account to set the owner of the group
379 # we use first admin account to set the owner of the group
380 existing_group = UserGroupModel().create(gr, desc, owner,
380 existing_group = UserGroupModel().create(gr, desc, owner,
381 group_data={'extern_type': extern_type})
381 group_data={'extern_type': extern_type})
General Comments 0
You need to be logged in to leave comments. Login now