##// END OF EJS Templates
formatting and small changes
marcink -
r4019:18121c54 default
parent child Browse files
Show More
@@ -68,8 +68,7 b' class UserModel(BaseModel):'
68 if case_insensitive:
68 if case_insensitive:
69 user = self.sa.query(User).filter(User.username.ilike(username))
69 user = self.sa.query(User).filter(User.username.ilike(username))
70 else:
70 else:
71 user = self.sa.query(User)\
71 user = self.sa.query(User).filter(User.username == username)
72 .filter(User.username == username)
73 if cache:
72 if cache:
74 user = user.options(FromCache("sql_cache_short",
73 user = user.options(FromCache("sql_cache_short",
75 "get_user_%s" % username))
74 "get_user_%s" % username))
@@ -105,7 +104,8 b' class UserModel(BaseModel):'
105 raise
104 raise
106
105
107 def create_or_update(self, username, password, email, firstname='',
106 def create_or_update(self, username, password, email, firstname='',
108 lastname='', active=True, admin=False, ldap_dn=None, cur_user=None):
107 lastname='', active=True, admin=False, ldap_dn=None,
108 cur_user=None):
109 """
109 """
110 Creates a new instance if not found, or updates current one
110 Creates a new instance if not found, or updates current one
111
111
@@ -118,6 +118,7 b' class UserModel(BaseModel):'
118 :param active:
118 :param active:
119 :param admin:
119 :param admin:
120 :param ldap_dn:
120 :param ldap_dn:
121 :param cur_user:
121 """
122 """
122 if not cur_user:
123 if not cur_user:
123 cur_user = getattr(get_current_rhodecode_user(), 'username', None)
124 cur_user = getattr(get_current_rhodecode_user(), 'username', None)
@@ -163,6 +164,7 b' class UserModel(BaseModel):'
163
164
164 :param username:
165 :param username:
165 :param attrs:
166 :param attrs:
167 :param cur_user:
166 """
168 """
167 if not cur_user:
169 if not cur_user:
168 cur_user = getattr(get_current_rhodecode_user(), 'username', None)
170 cur_user = getattr(get_current_rhodecode_user(), 'username', None)
@@ -203,6 +205,7 b' class UserModel(BaseModel):'
203 :param password:
205 :param password:
204 :param user_dn:
206 :param user_dn:
205 :param attrs:
207 :param attrs:
208 :param cur_user:
206 """
209 """
207 if not cur_user:
210 if not cur_user:
208 cur_user = getattr(get_current_rhodecode_user(), 'username', None)
211 cur_user = getattr(get_current_rhodecode_user(), 'username', None)
@@ -256,8 +259,7 b' class UserModel(BaseModel):'
256 '- Username: %s\n'
259 '- Username: %s\n'
257 '- Full Name: %s\n'
260 '- Full Name: %s\n'
258 '- Email: %s\n')
261 '- Email: %s\n')
259 body = body % (new_user.username, new_user.full_name,
262 body = body % (new_user.username, new_user.full_name, new_user.email)
260 new_user.email)
261 edit_url = url('edit_user', id=new_user.user_id, qualified=True)
263 edit_url = url('edit_user', id=new_user.user_id, qualified=True)
262 kw = {'registered_user_url': edit_url}
264 kw = {'registered_user_url': edit_url}
263 NotificationModel().create(created_by=new_user, subject=subject,
265 NotificationModel().create(created_by=new_user, subject=subject,
@@ -390,7 +392,7 b' class UserModel(BaseModel):'
390
392
391 run_task(tasks.send_email, user_email,
393 run_task(tasks.send_email, user_email,
392 _('Your new password'),
394 _('Your new password'),
393 _('Your new RhodeCode password:%s') % (new_passwd))
395 _('Your new RhodeCode password:%s') % (new_passwd,))
394 log.info('send new password mail to %s' % user_email)
396 log.info('send new password mail to %s' % user_email)
395
397
396 except Exception:
398 except Exception:
General Comments 0
You need to be logged in to leave comments. Login now