##// END OF EJS Templates
garden...
marcink -
r1976:a76e9bac beta
parent child Browse files
Show More
@@ -101,7 +101,7 b' class SettingsController(BaseController)'
101 # url('admin_setting', setting_id=ID)
101 # url('admin_setting', setting_id=ID)
102 if setting_id == 'mapping':
102 if setting_id == 'mapping':
103 rm_obsolete = request.POST.get('destroy', False)
103 rm_obsolete = request.POST.get('destroy', False)
104 log.debug('Rescanning directories with destroy=%s', rm_obsolete)
104 log.debug('Rescanning directories with destroy=%s' % rm_obsolete)
105 initial = ScmModel().repo_scan()
105 initial = ScmModel().repo_scan()
106 log.debug('invalidating all repositories')
106 log.debug('invalidating all repositories')
107 for repo_name in initial.keys():
107 for repo_name in initial.keys():
@@ -100,7 +100,7 b' class JSONRPCController(WSGIController):'
100 else:
100 else:
101 length = environ['CONTENT_LENGTH'] or 0
101 length = environ['CONTENT_LENGTH'] or 0
102 length = int(environ['CONTENT_LENGTH'])
102 length = int(environ['CONTENT_LENGTH'])
103 log.debug('Content-Length: %s', length)
103 log.debug('Content-Length: %s' % length)
104
104
105 if length == 0:
105 if length == 0:
106 log.debug("Content-Length is 0")
106 log.debug("Content-Length is 0")
@@ -121,9 +121,10 b' class JSONRPCController(WSGIController):'
121 self._req_id = json_body['id']
121 self._req_id = json_body['id']
122 self._req_method = json_body['method']
122 self._req_method = json_body['method']
123 self._request_params = json_body['args']
123 self._request_params = json_body['args']
124 log.debug('method: %s, params: %s',
124 log.debug(
125 self._req_method,
125 'method: %s, params: %s' % (self._req_method,
126 self._request_params)
126 self._request_params)
127 )
127 except KeyError, e:
128 except KeyError, e:
128 return jsonrpc_error(message='Incorrect JSON query missing %s' % e)
129 return jsonrpc_error(message='Incorrect JSON query missing %s' % e)
129
130
@@ -232,7 +233,7 b' class JSONRPCController(WSGIController):'
232 try:
233 try:
233 return json.dumps(response)
234 return json.dumps(response)
234 except TypeError, e:
235 except TypeError, e:
235 log.debug('Error encoding response: %s', e)
236 log.debug('Error encoding response: %s' % e)
236 return json.dumps(
237 return json.dumps(
237 dict(
238 dict(
238 self._req_id,
239 self._req_id,
@@ -245,7 +246,7 b' class JSONRPCController(WSGIController):'
245 """
246 """
246 Return method named by `self._req_method` in controller if able
247 Return method named by `self._req_method` in controller if able
247 """
248 """
248 log.debug('Trying to find JSON-RPC method: %s', self._req_method)
249 log.debug('Trying to find JSON-RPC method: %s' % self._req_method)
249 if self._req_method.startswith('_'):
250 if self._req_method.startswith('_'):
250 raise AttributeError("Method not allowed")
251 raise AttributeError("Method not allowed")
251
252
@@ -54,7 +54,7 b' class ErrorController(BaseController):'
54 resp = request.environ.get('pylons.original_response')
54 resp = request.environ.get('pylons.original_response')
55 c.rhodecode_name = config.get('rhodecode_title')
55 c.rhodecode_name = config.get('rhodecode_title')
56
56
57 log.debug('### %s ###', resp.status)
57 log.debug('### %s ###' % resp.status)
58
58
59 e = request.environ
59 e = request.environ
60 c.serv_p = r'%(protocol)s://%(host)s/' \
60 c.serv_p = r'%(protocol)s://%(host)s/' \
@@ -149,7 +149,7 b' class JournalController(BaseController):'
149 except:
149 except:
150 raise HTTPBadRequest()
150 raise HTTPBadRequest()
151
151
152 log.debug('token mismatch %s vs %s', cur_token, token)
152 log.debug('token mismatch %s vs %s' % (cur_token, token))
153 raise HTTPBadRequest()
153 raise HTTPBadRequest()
154
154
155 @LoginRequired()
155 @LoginRequired()
@@ -177,10 +177,10 b' def authenticate(username, password):'
177
177
178 elif user.username == username and check_password(password,
178 elif user.username == username and check_password(password,
179 user.password):
179 user.password):
180 log.info('user %s authenticated correctly', username)
180 log.info('user %s authenticated correctly' % username)
181 return True
181 return True
182 else:
182 else:
183 log.warning('user %s is disabled', username)
183 log.warning('user %s is disabled' % username)
184
184
185 else:
185 else:
186 log.debug('Regular authentication failed')
186 log.debug('Regular authentication failed')
@@ -214,7 +214,7 b' def authenticate(username, password):'
214 aldap = AuthLdap(**kwargs)
214 aldap = AuthLdap(**kwargs)
215 (user_dn, ldap_attrs) = aldap.authenticate_ldap(username,
215 (user_dn, ldap_attrs) = aldap.authenticate_ldap(username,
216 password)
216 password)
217 log.debug('Got ldap DN response %s', user_dn)
217 log.debug('Got ldap DN response %s' % user_dn)
218
218
219 get_ldap_attr = lambda k: ldap_attrs.get(ldap_settings\
219 get_ldap_attr = lambda k: ldap_attrs.get(ldap_settings\
220 .get(k), [''])[0]
220 .get(k), [''])[0]
@@ -227,7 +227,7 b' def authenticate(username, password):'
227
227
228 if user_model.create_ldap(username, password, user_dn,
228 if user_model.create_ldap(username, password, user_dn,
229 user_attrs):
229 user_attrs):
230 log.info('created new ldap user %s', username)
230 log.info('created new ldap user %s' % username)
231
231
232 Session.commit()
232 Session.commit()
233 return True
233 return True
@@ -250,7 +250,7 b' def login_container_auth(username):'
250 user = UserModel().create_for_container_auth(username, user_attrs)
250 user = UserModel().create_for_container_auth(username, user_attrs)
251 if not user:
251 if not user:
252 return None
252 return None
253 log.info('User %s was created by container authentication', username)
253 log.info('User %s was created by container authentication' % username)
254
254
255 if not user.active:
255 if not user.active:
256 return None
256 return None
@@ -277,7 +277,7 b' def get_container_username(environ, conf'
277 # Removing realm and domain from username
277 # Removing realm and domain from username
278 username = username.partition('@')[0]
278 username = username.partition('@')[0]
279 username = username.rpartition('\\')[2]
279 username = username.rpartition('\\')[2]
280 log.debug('Received username %s from container', username)
280 log.debug('Received username %s from container' % username)
281
281
282 return username
282 return username
283
283
@@ -315,18 +315,18 b' class AuthUser(object):'
315
315
316 # try go get user by api key
316 # try go get user by api key
317 if self._api_key and self._api_key != self.anonymous_user.api_key:
317 if self._api_key and self._api_key != self.anonymous_user.api_key:
318 log.debug('Auth User lookup by API KEY %s', self._api_key)
318 log.debug('Auth User lookup by API KEY %s' % self._api_key)
319 is_user_loaded = user_model.fill_data(self, api_key=self._api_key)
319 is_user_loaded = user_model.fill_data(self, api_key=self._api_key)
320 # lookup by userid
320 # lookup by userid
321 elif (self.user_id is not None and
321 elif (self.user_id is not None and
322 self.user_id != self.anonymous_user.user_id):
322 self.user_id != self.anonymous_user.user_id):
323 log.debug('Auth User lookup by USER ID %s', self.user_id)
323 log.debug('Auth User lookup by USER ID %s' % self.user_id)
324 is_user_loaded = user_model.fill_data(self, user_id=self.user_id)
324 is_user_loaded = user_model.fill_data(self, user_id=self.user_id)
325 # lookup by username
325 # lookup by username
326 elif self.username and \
326 elif self.username and \
327 str2bool(config.get('container_auth_enabled', False)):
327 str2bool(config.get('container_auth_enabled', False)):
328
328
329 log.debug('Auth User lookup by USER NAME %s', self.username)
329 log.debug('Auth User lookup by USER NAME %s' % self.username)
330 dbuser = login_container_auth(self.username)
330 dbuser = login_container_auth(self.username)
331 if dbuser is not None:
331 if dbuser is not None:
332 for k, v in dbuser.get_dict().items():
332 for k, v in dbuser.get_dict().items():
@@ -348,7 +348,7 b' class AuthUser(object):'
348 if not self.username:
348 if not self.username:
349 self.username = 'None'
349 self.username = 'None'
350
350
351 log.debug('Auth User is now %s', self)
351 log.debug('Auth User is now %s' % self)
352 user_model.fill_perms(self)
352 user_model.fill_perms(self)
353
353
354 @property
354 @property
@@ -422,21 +422,21 b' class LoginRequired(object):'
422
422
423 api_access_ok = False
423 api_access_ok = False
424 if self.api_access:
424 if self.api_access:
425 log.debug('Checking API KEY access for %s', cls)
425 log.debug('Checking API KEY access for %s' % cls)
426 if user.api_key == request.GET.get('api_key'):
426 if user.api_key == request.GET.get('api_key'):
427 api_access_ok = True
427 api_access_ok = True
428 else:
428 else:
429 log.debug("API KEY token not valid")
429 log.debug("API KEY token not valid")
430
430
431 log.debug('Checking if %s is authenticated @ %s', user.username, cls)
431 log.debug('Checking if %s is authenticated @ %s' % (user.username, cls))
432 if user.is_authenticated or api_access_ok:
432 if user.is_authenticated or api_access_ok:
433 log.debug('user %s is authenticated', user.username)
433 log.debug('user %s is authenticated' % user.username)
434 return func(*fargs, **fkwargs)
434 return func(*fargs, **fkwargs)
435 else:
435 else:
436 log.warn('user %s NOT authenticated', user.username)
436 log.warn('user %s NOT authenticated' % user.username)
437 p = url.current()
437 p = url.current()
438
438
439 log.debug('redirecting to login page with %s', p)
439 log.debug('redirecting to login page with %s' % p)
440 return redirect(url('login_home', came_from=p))
440 return redirect(url('login_home', came_from=p))
441
441
442
442
@@ -452,7 +452,7 b' class NotAnonymous(object):'
452 cls = fargs[0]
452 cls = fargs[0]
453 self.user = cls.rhodecode_user
453 self.user = cls.rhodecode_user
454
454
455 log.debug('Checking if user is not anonymous @%s', cls)
455 log.debug('Checking if user is not anonymous @%s' % cls)
456
456
457 anonymous = self.user.username == 'default'
457 anonymous = self.user.username == 'default'
458
458
@@ -491,11 +491,11 b' class PermsDecorator(object):'
491 self.user)
491 self.user)
492
492
493 if self.check_permissions():
493 if self.check_permissions():
494 log.debug('Permission granted for %s %s', cls, self.user)
494 log.debug('Permission granted for %s %s' % (cls, self.user))
495 return func(*fargs, **fkwargs)
495 return func(*fargs, **fkwargs)
496
496
497 else:
497 else:
498 log.warning('Permission denied for %s %s', cls, self.user)
498 log.warning('Permission denied for %s %s' % (cls, self.user))
499 anonymous = self.user.username == 'default'
499 anonymous = self.user.username == 'default'
500
500
501 if anonymous:
501 if anonymous:
@@ -138,8 +138,11 b' class AuthLdap(object):'
138 break
138 break
139
139
140 except ldap.INVALID_CREDENTIALS:
140 except ldap.INVALID_CREDENTIALS:
141 log.debug("LDAP rejected password for user '%s' (%s): %s",
141 log.debug(
142 uid, username, dn)
142 "LDAP rejected password for user '%s' (%s): %s" % (
143 uid, username, dn
144 )
145 )
143
146
144 else:
147 else:
145 log.debug("No matching LDAP objects for authentication "
148 log.debug("No matching LDAP objects for authentication "
@@ -147,7 +150,7 b' class AuthLdap(object):'
147 raise LdapPasswordError()
150 raise LdapPasswordError()
148
151
149 except ldap.NO_SUCH_OBJECT:
152 except ldap.NO_SUCH_OBJECT:
150 log.debug("LDAP says no such user '%s' (%s)", uid, username)
153 log.debug("LDAP says no such user '%s' (%s)" % (uid, username))
151 raise LdapUsernameError()
154 raise LdapUsernameError()
152 except ldap.SERVER_DOWN:
155 except ldap.SERVER_DOWN:
153 raise LdapConnectionError("LDAP can't access "
156 raise LdapConnectionError("LDAP can't access "
@@ -62,7 +62,7 b' def run_task(task, *args, **kwargs):'
62 if CELERY_ON:
62 if CELERY_ON:
63 try:
63 try:
64 t = task.apply_async(args=args, kwargs=kwargs)
64 t = task.apply_async(args=args, kwargs=kwargs)
65 log.info('running task %s:%s', t.task_id, task)
65 log.info('running task %s:%s' % (t.task_id, task))
66 return t
66 return t
67
67
68 except socket.error, e:
68 except socket.error, e:
@@ -75,7 +75,7 b' def run_task(task, *args, **kwargs):'
75 except Exception, e:
75 except Exception, e:
76 log.error(traceback.format_exc())
76 log.error(traceback.format_exc())
77
77
78 log.debug('executing task %s in sync mode', task)
78 log.debug('executing task %s in sync mode' % task)
79 return ResultWrapper(task(*args, **kwargs))
79 return ResultWrapper(task(*args, **kwargs))
80
80
81
81
@@ -95,7 +95,7 b' def locked_task(func):'
95 lockkey = __get_lockkey(func, *fargs, **fkwargs)
95 lockkey = __get_lockkey(func, *fargs, **fkwargs)
96 lockkey_path = config['here']
96 lockkey_path = config['here']
97
97
98 log.info('running task with lockkey %s', lockkey)
98 log.info('running task with lockkey %s' % lockkey)
99 try:
99 try:
100 l = DaemonLock(file_=jn(lockkey_path, lockkey))
100 l = DaemonLock(file_=jn(lockkey_path, lockkey))
101 ret = func(*fargs, **fkwargs)
101 ret = func(*fargs, **fkwargs)
@@ -92,12 +92,12 b' def get_commits_stats(repo_name, ts_min_'
92 ts_max_y)
92 ts_max_y)
93 lockkey_path = config['here']
93 lockkey_path = config['here']
94
94
95 log.info('running task with lockkey %s', lockkey)
95 log.info('running task with lockkey %s' % lockkey)
96
96
97 try:
97 try:
98 lock = l = DaemonLock(file_=jn(lockkey_path, lockkey))
98 lock = l = DaemonLock(file_=jn(lockkey_path, lockkey))
99
99
100 # for js data compatibilty cleans the key for person from '
100 # for js data compatibility cleans the key for person from '
101 akc = lambda k: person(k).replace('"', "")
101 akc = lambda k: person(k).replace('"', "")
102
102
103 co_day_auth_aggr = {}
103 co_day_auth_aggr = {}
@@ -139,7 +139,7 b' def get_commits_stats(repo_name, ts_min_'
139 cur_stats.commit_activity_combined))
139 cur_stats.commit_activity_combined))
140 co_day_auth_aggr = json.loads(cur_stats.commit_activity)
140 co_day_auth_aggr = json.loads(cur_stats.commit_activity)
141
141
142 log.debug('starting parsing %s', parse_limit)
142 log.debug('starting parsing %s' % parse_limit)
143 lmktime = mktime
143 lmktime = mktime
144
144
145 last_rev = last_rev + 1 if last_rev >= 0 else 0
145 last_rev = last_rev + 1 if last_rev >= 0 else 0
@@ -214,9 +214,9 b' def get_commits_stats(repo_name, ts_min_'
214 stats.commit_activity = json.dumps(co_day_auth_aggr)
214 stats.commit_activity = json.dumps(co_day_auth_aggr)
215 stats.commit_activity_combined = json.dumps(overview_data)
215 stats.commit_activity_combined = json.dumps(overview_data)
216
216
217 log.debug('last revison %s', last_rev)
217 log.debug('last revison %s' % last_rev)
218 leftovers = len(repo.revisions[last_rev:])
218 leftovers = len(repo.revisions[last_rev:])
219 log.debug('revisions to parse %s', leftovers)
219 log.debug('revisions to parse %s' % leftovers)
220
220
221 if last_rev == 0 or leftovers < parse_limit:
221 if last_rev == 0 or leftovers < parse_limit:
222 log.debug('getting code trending stats')
222 log.debug('getting code trending stats')
@@ -265,7 +265,7 b' def send_password_link(user_email):'
265 log.debug('sending email')
265 log.debug('sending email')
266 run_task(send_email, user_email,
266 run_task(send_email, user_email,
267 _("password reset link"), body)
267 _("password reset link"), body)
268 log.info('send new password mail to %s', user_email)
268 log.info('send new password mail to %s' % user_email)
269 else:
269 else:
270 log.debug("password reset email %s not found" % user_email)
270 log.debug("password reset email %s not found" % user_email)
271 except:
271 except:
@@ -292,7 +292,7 b' def reset_user_password(user_email):'
292 user.api_key = auth.generate_api_key(user.username)
292 user.api_key = auth.generate_api_key(user.username)
293 DBS.add(user)
293 DBS.add(user)
294 DBS.commit()
294 DBS.commit()
295 log.info('change password for %s', user_email)
295 log.info('change password for %s' % user_email)
296 if new_passwd is None:
296 if new_passwd is None:
297 raise Exception('unable to generate new password')
297 raise Exception('unable to generate new password')
298 except:
298 except:
@@ -302,7 +302,7 b' def reset_user_password(user_email):'
302 run_task(send_email, user_email,
302 run_task(send_email, user_email,
303 'Your new password',
303 'Your new password',
304 'Your new RhodeCode password:%s' % (new_passwd))
304 'Your new RhodeCode password:%s' % (new_passwd))
305 log.info('send new password mail to %s', user_email)
305 log.info('send new password mail to %s' % user_email)
306
306
307 except:
307 except:
308 log.error('Failed to update user password')
308 log.error('Failed to update user password')
@@ -76,7 +76,7 b' class DbManage(object):'
76
76
77 checkfirst = not override
77 checkfirst = not override
78 meta.Base.metadata.create_all(checkfirst=checkfirst)
78 meta.Base.metadata.create_all(checkfirst=checkfirst)
79 log.info('Created tables for %s', self.dbname)
79 log.info('Created tables for %s' % self.dbname)
80
80
81 def set_db_version(self):
81 def set_db_version(self):
82 ver = DbMigrateVersion()
82 ver = DbMigrateVersion()
@@ -84,7 +84,7 b' class DbManage(object):'
84 ver.repository_id = 'rhodecode_db_migrations'
84 ver.repository_id = 'rhodecode_db_migrations'
85 ver.repository_path = 'versions'
85 ver.repository_path = 'versions'
86 self.sa.add(ver)
86 self.sa.add(ver)
87 log.info('db version set to: %s', __dbversion__)
87 log.info('db version set to: %s' % __dbversion__)
88
88
89 def upgrade(self):
89 def upgrade(self):
90 """
90 """
@@ -364,12 +364,12 b' class DbManage(object):'
364 # check proper dir
364 # check proper dir
365 if not os.path.isdir(path):
365 if not os.path.isdir(path):
366 path_ok = False
366 path_ok = False
367 log.error('Given path %s is not a valid directory', path)
367 log.error('Given path %s is not a valid directory' % path)
368
368
369 # check write access
369 # check write access
370 if not os.access(path, os.W_OK) and path_ok:
370 if not os.access(path, os.W_OK) and path_ok:
371 path_ok = False
371 path_ok = False
372 log.error('No write permission to given path %s', path)
372 log.error('No write permission to given path %s' % path)
373
373
374 if retries == 0:
374 if retries == 0:
375 sys.exit('max retries reached')
375 sys.exit('max retries reached')
@@ -427,7 +427,7 b' class DbManage(object):'
427 log.info('created ui config')
427 log.info('created ui config')
428
428
429 def create_user(self, username, password, email='', admin=False):
429 def create_user(self, username, password, email='', admin=False):
430 log.info('creating user %s', username)
430 log.info('creating user %s' % username)
431 UserModel().create_or_update(username, password, email,
431 UserModel().create_or_update(username, password, email,
432 name='RhodeCode', lastname='Admin',
432 name='RhodeCode', lastname='Admin',
433 active=True, admin=admin)
433 active=True, admin=admin)
@@ -159,7 +159,7 b' def with_engine(f, *a, **kw):'
159 return f(*a, **kw)
159 return f(*a, **kw)
160 finally:
160 finally:
161 if isinstance(engine, Engine):
161 if isinstance(engine, Engine):
162 log.debug('Disposing SQLAlchemy engine %s', engine)
162 log.debug('Disposing SQLAlchemy engine %s' % engine)
163 engine.dispose()
163 engine.dispose()
164
164
165
165
@@ -320,7 +320,7 b' class User(Base, BaseModel):'
320 self.last_login = datetime.datetime.now()
320 self.last_login = datetime.datetime.now()
321 Session.add(self)
321 Session.add(self)
322 Session.commit()
322 Session.commit()
323 log.debug('updated user %s lastlogin', self.username)
323 log.debug('updated user %s lastlogin' % self.username)
324
324
325 @classmethod
325 @classmethod
326 def create(cls, form_data):
326 def create(cls, form_data):
@@ -695,7 +695,7 b' class Repository(Base, BaseModel):'
695
695
696 try:
696 try:
697 alias = get_scm(repo_full_path)[0]
697 alias = get_scm(repo_full_path)[0]
698 log.debug('Creating instance of %s repository', alias)
698 log.debug('Creating instance of %s repository' % alias)
699 backend = get_backend(alias)
699 backend = get_backend(alias)
700 except VCSError:
700 except VCSError:
701 log.error(traceback.format_exc())
701 log.error(traceback.format_exc())
@@ -74,7 +74,7 b' class User(Base):'
74 self.last_login = datetime.datetime.now()
74 self.last_login = datetime.datetime.now()
75 session.add(self)
75 session.add(self)
76 session.commit()
76 session.commit()
77 log.debug('updated user %s lastlogin', self.username)
77 log.debug('updated user %s lastlogin' % self.username)
78 except (DatabaseError,):
78 except (DatabaseError,):
79 session.rollback()
79 session.rollback()
80
80
@@ -140,7 +140,7 b' def action_logger(user, action, repo, ip'
140 user_log.user_ip = ipaddr
140 user_log.user_ip = ipaddr
141 sa.add(user_log)
141 sa.add(user_log)
142
142
143 log.info('Adding user %s, action %s on %s', user_obj, action, repo)
143 log.info('Adding user %s, action %s on %s' % (user_obj, action, repo))
144 if commit:
144 if commit:
145 sa.commit()
145 sa.commit()
146 except:
146 except:
@@ -261,12 +261,12 b" def make_ui(read_from='file', path=None,"
261 if not os.path.isfile(path):
261 if not os.path.isfile(path):
262 log.warning('Unable to read config file %s' % path)
262 log.warning('Unable to read config file %s' % path)
263 return False
263 return False
264 log.debug('reading hgrc from %s', path)
264 log.debug('reading hgrc from %s' % path)
265 cfg = config.config()
265 cfg = config.config()
266 cfg.read(path)
266 cfg.read(path)
267 for section in ui_sections:
267 for section in ui_sections:
268 for k, v in cfg.items(section):
268 for k, v in cfg.items(section):
269 log.debug('settings ui from file[%s]%s:%s', section, k, v)
269 log.debug('settings ui from file[%s]%s:%s' % (section, k, v))
270 baseui.setconfig(section, k, v)
270 baseui.setconfig(section, k, v)
271
271
272 elif read_from == 'db':
272 elif read_from == 'db':
@@ -401,7 +401,7 b' def repo2db_mapper(initial_repo_list, re'
401 for name, repo in initial_repo_list.items():
401 for name, repo in initial_repo_list.items():
402 group = map_groups(name.split(Repository.url_sep()))
402 group = map_groups(name.split(Repository.url_sep()))
403 if not rm.get_by_repo_name(name, cache=False):
403 if not rm.get_by_repo_name(name, cache=False):
404 log.info('repository %s not found creating default', name)
404 log.info('repository %s not found creating default' % name)
405 added.append(name)
405 added.append(name)
406 form_data = {
406 form_data = {
407 'repo_name': name,
407 'repo_name': name,
@@ -494,7 +494,7 b' def create_test_env(repos_test_path, con'
494
494
495 # PART ONE create db
495 # PART ONE create db
496 dbconf = config['sqlalchemy.db1.url']
496 dbconf = config['sqlalchemy.db1.url']
497 log.debug('making test db %s', dbconf)
497 log.debug('making test db %s' % dbconf)
498
498
499 # create test dir if it doesn't exist
499 # create test dir if it doesn't exist
500 if not os.path.isdir(repos_test_path):
500 if not os.path.isdir(repos_test_path):
@@ -56,7 +56,7 b' def init_model(engine):'
56
56
57 :param engine: engine to bind to
57 :param engine: engine to bind to
58 """
58 """
59 log.info("initializing db for %s", engine)
59 log.info("initializing db for %s" % engine)
60 meta.Base.metadata.bind = engine
60 meta.Base.metadata.bind = engine
61
61
62
62
@@ -366,7 +366,7 b' class User(Base, BaseModel):'
366 """Update user lastlogin"""
366 """Update user lastlogin"""
367 self.last_login = datetime.datetime.now()
367 self.last_login = datetime.datetime.now()
368 Session.add(self)
368 Session.add(self)
369 log.debug('updated user %s lastlogin', self.username)
369 log.debug('updated user %s lastlogin' % self.username)
370
370
371 def __json__(self):
371 def __json__(self):
372 return dict(
372 return dict(
@@ -682,7 +682,7 b' class Repository(Base, BaseModel):'
682 repo_full_path = self.repo_full_path
682 repo_full_path = self.repo_full_path
683 try:
683 try:
684 alias = get_scm(repo_full_path)[0]
684 alias = get_scm(repo_full_path)[0]
685 log.debug('Creating instance of %s repository', alias)
685 log.debug('Creating instance of %s repository' % alias)
686 backend = get_backend(alias)
686 backend = get_backend(alias)
687 except VCSError:
687 except VCSError:
688 log.error(traceback.format_exc())
688 log.error(traceback.format_exc())
@@ -248,7 +248,7 b' class ValidAuth(formencode.validators.Fa'
248 return value
248 return value
249 else:
249 else:
250 if user and user.active is False:
250 if user and user.active is False:
251 log.warning('user %s is disabled', username)
251 log.warning('user %s is disabled' % username)
252 raise formencode.Invalid(
252 raise formencode.Invalid(
253 self.message('disabled_account',
253 self.message('disabled_account',
254 state=State_obj),
254 state=State_obj),
@@ -256,7 +256,7 b' class ValidAuth(formencode.validators.Fa'
256 error_dict=self.e_dict_disable
256 error_dict=self.e_dict_disable
257 )
257 )
258 else:
258 else:
259 log.warning('user %s not authenticated', username)
259 log.warning('user %s not authenticated' % username)
260 raise formencode.Invalid(
260 raise formencode.Invalid(
261 self.message('invalid_password',
261 self.message('invalid_password',
262 state=State_obj), value, state,
262 state=State_obj), value, state,
@@ -401,7 +401,7 b' class RepoModel(BaseModel):'
401 :param old: old name
401 :param old: old name
402 :param new: new name
402 :param new: new name
403 """
403 """
404 log.info('renaming repo from %s to %s', old, new)
404 log.info('renaming repo from %s to %s' % (old, new))
405
405
406 old_path = os.path.join(self.repos_path, old)
406 old_path = os.path.join(self.repos_path, old)
407 new_path = os.path.join(self.repos_path, new)
407 new_path = os.path.join(self.repos_path, new)
@@ -420,7 +420,7 b' class RepoModel(BaseModel):'
420 :param repo: repo object
420 :param repo: repo object
421 """
421 """
422 rm_path = os.path.join(self.repos_path, repo.repo_name)
422 rm_path = os.path.join(self.repos_path, repo.repo_name)
423 log.info("Removing %s", rm_path)
423 log.info("Removing %s" % (rm_path))
424 # disable hg/git
424 # disable hg/git
425 alias = repo.repo_type
425 alias = repo.repo_type
426 shutil.move(os.path.join(rm_path, '.%s' % alias),
426 shutil.move(os.path.join(rm_path, '.%s' % alias),
@@ -58,7 +58,7 b' class ReposGroupModel(BaseModel):'
58 """
58 """
59
59
60 create_path = os.path.join(self.repos_path, group_name)
60 create_path = os.path.join(self.repos_path, group_name)
61 log.debug('creating new group in %s', create_path)
61 log.debug('creating new group in %s' % create_path)
62
62
63 if os.path.isdir(create_path):
63 if os.path.isdir(create_path):
64 raise Exception('That directory already exists !')
64 raise Exception('That directory already exists !')
@@ -76,13 +76,12 b' class ReposGroupModel(BaseModel):'
76 log.debug('skipping group rename')
76 log.debug('skipping group rename')
77 return
77 return
78
78
79 log.debug('renaming repos group from %s to %s', old, new)
79 log.debug('renaming repos group from %s to %s' % (old, new))
80
81
80
82 old_path = os.path.join(self.repos_path, old)
81 old_path = os.path.join(self.repos_path, old)
83 new_path = os.path.join(self.repos_path, new)
82 new_path = os.path.join(self.repos_path, new)
84
83
85 log.debug('renaming repos paths from %s to %s', old_path, new_path)
84 log.debug('renaming repos paths from %s to %s' % (old_path, new_path))
86
85
87 if os.path.isdir(new_path):
86 if os.path.isdir(new_path):
88 raise Exception('Was trying to rename to already '
87 raise Exception('Was trying to rename to already '
@@ -110,13 +110,13 b' class UserModel(BaseModel):'
110
110
111 from rhodecode.lib.auth import get_crypt_password
111 from rhodecode.lib.auth import get_crypt_password
112
112
113 log.debug('Checking for %s account in RhodeCode database', username)
113 log.debug('Checking for %s account in RhodeCode database' % username)
114 user = User.get_by_username(username, case_insensitive=True)
114 user = User.get_by_username(username, case_insensitive=True)
115 if user is None:
115 if user is None:
116 log.debug('creating new user %s', username)
116 log.debug('creating new user %s' % username)
117 new_user = User()
117 new_user = User()
118 else:
118 else:
119 log.debug('updating user %s', username)
119 log.debug('updating user %s' % username)
120 new_user = user
120 new_user = user
121
121
122 try:
122 try:
@@ -327,7 +327,7 b' class UserModel(BaseModel):'
327 dbuser = self.get(user_id)
327 dbuser = self.get(user_id)
328
328
329 if dbuser is not None and dbuser.active:
329 if dbuser is not None and dbuser.active:
330 log.debug('filling %s data', dbuser)
330 log.debug('filling %s data' % dbuser)
331 for k, v in dbuser.get_dict().items():
331 for k, v in dbuser.get_dict().items():
332 setattr(auth_user, k, v)
332 setattr(auth_user, k, v)
333 else:
333 else:
General Comments 0
You need to be logged in to leave comments. Login now