# HG changeset patch # User Marcin Kuzminski # Date 1328135460 -7200 # Node ID a76e9bacbedc3561ce7e86ed5ebe7f8afbf8fa79 # Parent 9c5b33c4de4d0ca491bdc3364a8890a6f029e617 garden - unified logging formatting to use only % diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/controllers/admin/settings.py --- a/rhodecode/controllers/admin/settings.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/controllers/admin/settings.py Thu Feb 02 00:31:00 2012 +0200 @@ -101,7 +101,7 @@ # url('admin_setting', setting_id=ID) if setting_id == 'mapping': rm_obsolete = request.POST.get('destroy', False) - log.debug('Rescanning directories with destroy=%s', rm_obsolete) + log.debug('Rescanning directories with destroy=%s' % rm_obsolete) initial = ScmModel().repo_scan() log.debug('invalidating all repositories') for repo_name in initial.keys(): diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/controllers/api/__init__.py --- a/rhodecode/controllers/api/__init__.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/controllers/api/__init__.py Thu Feb 02 00:31:00 2012 +0200 @@ -100,7 +100,7 @@ else: length = environ['CONTENT_LENGTH'] or 0 length = int(environ['CONTENT_LENGTH']) - log.debug('Content-Length: %s', length) + log.debug('Content-Length: %s' % length) if length == 0: log.debug("Content-Length is 0") @@ -121,9 +121,10 @@ self._req_id = json_body['id'] self._req_method = json_body['method'] self._request_params = json_body['args'] - log.debug('method: %s, params: %s', - self._req_method, - self._request_params) + log.debug( + 'method: %s, params: %s' % (self._req_method, + self._request_params) + ) except KeyError, e: return jsonrpc_error(message='Incorrect JSON query missing %s' % e) @@ -232,7 +233,7 @@ try: return json.dumps(response) except TypeError, e: - log.debug('Error encoding response: %s', e) + log.debug('Error encoding response: %s' % e) return json.dumps( dict( self._req_id, @@ -245,7 +246,7 @@ """ Return method named by `self._req_method` in controller if able """ - log.debug('Trying to find JSON-RPC method: %s', self._req_method) + log.debug('Trying to find JSON-RPC method: %s' % self._req_method) if self._req_method.startswith('_'): raise AttributeError("Method not allowed") diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/controllers/error.py --- a/rhodecode/controllers/error.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/controllers/error.py Thu Feb 02 00:31:00 2012 +0200 @@ -54,7 +54,7 @@ resp = request.environ.get('pylons.original_response') c.rhodecode_name = config.get('rhodecode_title') - log.debug('### %s ###', resp.status) + log.debug('### %s ###' % resp.status) e = request.environ c.serv_p = r'%(protocol)s://%(host)s/' \ diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/controllers/journal.py --- a/rhodecode/controllers/journal.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/controllers/journal.py Thu Feb 02 00:31:00 2012 +0200 @@ -149,7 +149,7 @@ except: raise HTTPBadRequest() - log.debug('token mismatch %s vs %s', cur_token, token) + log.debug('token mismatch %s vs %s' % (cur_token, token)) raise HTTPBadRequest() @LoginRequired() diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/auth.py --- a/rhodecode/lib/auth.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/auth.py Thu Feb 02 00:31:00 2012 +0200 @@ -177,10 +177,10 @@ elif user.username == username and check_password(password, user.password): - log.info('user %s authenticated correctly', username) + log.info('user %s authenticated correctly' % username) return True else: - log.warning('user %s is disabled', username) + log.warning('user %s is disabled' % username) else: log.debug('Regular authentication failed') @@ -214,7 +214,7 @@ aldap = AuthLdap(**kwargs) (user_dn, ldap_attrs) = aldap.authenticate_ldap(username, password) - log.debug('Got ldap DN response %s', user_dn) + log.debug('Got ldap DN response %s' % user_dn) get_ldap_attr = lambda k: ldap_attrs.get(ldap_settings\ .get(k), [''])[0] @@ -227,7 +227,7 @@ if user_model.create_ldap(username, password, user_dn, user_attrs): - log.info('created new ldap user %s', username) + log.info('created new ldap user %s' % username) Session.commit() return True @@ -250,7 +250,7 @@ user = UserModel().create_for_container_auth(username, user_attrs) if not user: return None - log.info('User %s was created by container authentication', username) + log.info('User %s was created by container authentication' % username) if not user.active: return None @@ -277,7 +277,7 @@ # Removing realm and domain from username username = username.partition('@')[0] username = username.rpartition('\\')[2] - log.debug('Received username %s from container', username) + log.debug('Received username %s from container' % username) return username @@ -315,18 +315,18 @@ # try go get user by api key if self._api_key and self._api_key != self.anonymous_user.api_key: - log.debug('Auth User lookup by API KEY %s', self._api_key) + log.debug('Auth User lookup by API KEY %s' % self._api_key) is_user_loaded = user_model.fill_data(self, api_key=self._api_key) # lookup by userid elif (self.user_id is not None and self.user_id != self.anonymous_user.user_id): - log.debug('Auth User lookup by USER ID %s', self.user_id) + log.debug('Auth User lookup by USER ID %s' % self.user_id) is_user_loaded = user_model.fill_data(self, user_id=self.user_id) # lookup by username elif self.username and \ str2bool(config.get('container_auth_enabled', False)): - log.debug('Auth User lookup by USER NAME %s', self.username) + log.debug('Auth User lookup by USER NAME %s' % self.username) dbuser = login_container_auth(self.username) if dbuser is not None: for k, v in dbuser.get_dict().items(): @@ -348,7 +348,7 @@ if not self.username: self.username = 'None' - log.debug('Auth User is now %s', self) + log.debug('Auth User is now %s' % self) user_model.fill_perms(self) @property @@ -422,21 +422,21 @@ api_access_ok = False if self.api_access: - log.debug('Checking API KEY access for %s', cls) + log.debug('Checking API KEY access for %s' % cls) if user.api_key == request.GET.get('api_key'): api_access_ok = True else: log.debug("API KEY token not valid") - log.debug('Checking if %s is authenticated @ %s', user.username, cls) + log.debug('Checking if %s is authenticated @ %s' % (user.username, cls)) if user.is_authenticated or api_access_ok: - log.debug('user %s is authenticated', user.username) + log.debug('user %s is authenticated' % user.username) return func(*fargs, **fkwargs) else: - log.warn('user %s NOT authenticated', user.username) + log.warn('user %s NOT authenticated' % user.username) p = url.current() - log.debug('redirecting to login page with %s', p) + log.debug('redirecting to login page with %s' % p) return redirect(url('login_home', came_from=p)) @@ -452,7 +452,7 @@ cls = fargs[0] self.user = cls.rhodecode_user - log.debug('Checking if user is not anonymous @%s', cls) + log.debug('Checking if user is not anonymous @%s' % cls) anonymous = self.user.username == 'default' @@ -491,11 +491,11 @@ self.user) if self.check_permissions(): - log.debug('Permission granted for %s %s', cls, self.user) + log.debug('Permission granted for %s %s' % (cls, self.user)) return func(*fargs, **fkwargs) else: - log.warning('Permission denied for %s %s', cls, self.user) + log.warning('Permission denied for %s %s' % (cls, self.user)) anonymous = self.user.username == 'default' if anonymous: diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/auth_ldap.py --- a/rhodecode/lib/auth_ldap.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/auth_ldap.py Thu Feb 02 00:31:00 2012 +0200 @@ -138,8 +138,11 @@ break except ldap.INVALID_CREDENTIALS: - log.debug("LDAP rejected password for user '%s' (%s): %s", - uid, username, dn) + log.debug( + "LDAP rejected password for user '%s' (%s): %s" % ( + uid, username, dn + ) + ) else: log.debug("No matching LDAP objects for authentication " @@ -147,7 +150,7 @@ raise LdapPasswordError() except ldap.NO_SUCH_OBJECT: - log.debug("LDAP says no such user '%s' (%s)", uid, username) + log.debug("LDAP says no such user '%s' (%s)" % (uid, username)) raise LdapUsernameError() except ldap.SERVER_DOWN: raise LdapConnectionError("LDAP can't access " diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/celerylib/__init__.py --- a/rhodecode/lib/celerylib/__init__.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/celerylib/__init__.py Thu Feb 02 00:31:00 2012 +0200 @@ -62,7 +62,7 @@ if CELERY_ON: try: t = task.apply_async(args=args, kwargs=kwargs) - log.info('running task %s:%s', t.task_id, task) + log.info('running task %s:%s' % (t.task_id, task)) return t except socket.error, e: @@ -75,7 +75,7 @@ except Exception, e: log.error(traceback.format_exc()) - log.debug('executing task %s in sync mode', task) + log.debug('executing task %s in sync mode' % task) return ResultWrapper(task(*args, **kwargs)) @@ -95,7 +95,7 @@ lockkey = __get_lockkey(func, *fargs, **fkwargs) lockkey_path = config['here'] - log.info('running task with lockkey %s', lockkey) + log.info('running task with lockkey %s' % lockkey) try: l = DaemonLock(file_=jn(lockkey_path, lockkey)) ret = func(*fargs, **fkwargs) diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/celerylib/tasks.py --- a/rhodecode/lib/celerylib/tasks.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/celerylib/tasks.py Thu Feb 02 00:31:00 2012 +0200 @@ -92,12 +92,12 @@ ts_max_y) lockkey_path = config['here'] - log.info('running task with lockkey %s', lockkey) + log.info('running task with lockkey %s' % lockkey) try: lock = l = DaemonLock(file_=jn(lockkey_path, lockkey)) - # for js data compatibilty cleans the key for person from ' + # for js data compatibility cleans the key for person from ' akc = lambda k: person(k).replace('"', "") co_day_auth_aggr = {} @@ -139,7 +139,7 @@ cur_stats.commit_activity_combined)) co_day_auth_aggr = json.loads(cur_stats.commit_activity) - log.debug('starting parsing %s', parse_limit) + log.debug('starting parsing %s' % parse_limit) lmktime = mktime last_rev = last_rev + 1 if last_rev >= 0 else 0 @@ -214,9 +214,9 @@ stats.commit_activity = json.dumps(co_day_auth_aggr) stats.commit_activity_combined = json.dumps(overview_data) - log.debug('last revison %s', last_rev) + log.debug('last revison %s' % last_rev) leftovers = len(repo.revisions[last_rev:]) - log.debug('revisions to parse %s', leftovers) + log.debug('revisions to parse %s' % leftovers) if last_rev == 0 or leftovers < parse_limit: log.debug('getting code trending stats') @@ -265,7 +265,7 @@ log.debug('sending email') run_task(send_email, user_email, _("password reset link"), body) - log.info('send new password mail to %s', user_email) + log.info('send new password mail to %s' % user_email) else: log.debug("password reset email %s not found" % user_email) except: @@ -292,7 +292,7 @@ user.api_key = auth.generate_api_key(user.username) DBS.add(user) DBS.commit() - log.info('change password for %s', user_email) + log.info('change password for %s' % user_email) if new_passwd is None: raise Exception('unable to generate new password') except: @@ -302,7 +302,7 @@ run_task(send_email, user_email, 'Your new password', 'Your new RhodeCode password:%s' % (new_passwd)) - log.info('send new password mail to %s', user_email) + log.info('send new password mail to %s' % user_email) except: log.error('Failed to update user password') diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/db_manage.py --- a/rhodecode/lib/db_manage.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/db_manage.py Thu Feb 02 00:31:00 2012 +0200 @@ -76,7 +76,7 @@ checkfirst = not override meta.Base.metadata.create_all(checkfirst=checkfirst) - log.info('Created tables for %s', self.dbname) + log.info('Created tables for %s' % self.dbname) def set_db_version(self): ver = DbMigrateVersion() @@ -84,7 +84,7 @@ ver.repository_id = 'rhodecode_db_migrations' ver.repository_path = 'versions' self.sa.add(ver) - log.info('db version set to: %s', __dbversion__) + log.info('db version set to: %s' % __dbversion__) def upgrade(self): """ @@ -364,12 +364,12 @@ # check proper dir if not os.path.isdir(path): path_ok = False - log.error('Given path %s is not a valid directory', path) + log.error('Given path %s is not a valid directory' % path) # check write access if not os.access(path, os.W_OK) and path_ok: path_ok = False - log.error('No write permission to given path %s', path) + log.error('No write permission to given path %s' % path) if retries == 0: sys.exit('max retries reached') @@ -427,7 +427,7 @@ log.info('created ui config') def create_user(self, username, password, email='', admin=False): - log.info('creating user %s', username) + log.info('creating user %s' % username) UserModel().create_or_update(username, password, email, name='RhodeCode', lastname='Admin', active=True, admin=admin) diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py --- a/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py Thu Feb 02 00:31:00 2012 +0200 @@ -159,7 +159,7 @@ return f(*a, **kw) finally: if isinstance(engine, Engine): - log.debug('Disposing SQLAlchemy engine %s', engine) + log.debug('Disposing SQLAlchemy engine %s' % engine) engine.dispose() diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/dbmigrate/schema/db_1_2_0.py --- a/rhodecode/lib/dbmigrate/schema/db_1_2_0.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/dbmigrate/schema/db_1_2_0.py Thu Feb 02 00:31:00 2012 +0200 @@ -320,7 +320,7 @@ self.last_login = datetime.datetime.now() Session.add(self) Session.commit() - log.debug('updated user %s lastlogin', self.username) + log.debug('updated user %s lastlogin' % self.username) @classmethod def create(cls, form_data): @@ -695,7 +695,7 @@ try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository', alias) + log.debug('Creating instance of %s repository' % alias) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/dbmigrate/versions/001_initial_release.py --- a/rhodecode/lib/dbmigrate/versions/001_initial_release.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/dbmigrate/versions/001_initial_release.py Thu Feb 02 00:31:00 2012 +0200 @@ -74,7 +74,7 @@ self.last_login = datetime.datetime.now() session.add(self) session.commit() - log.debug('updated user %s lastlogin', self.username) + log.debug('updated user %s lastlogin' % self.username) except (DatabaseError,): session.rollback() diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/lib/utils.py --- a/rhodecode/lib/utils.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/lib/utils.py Thu Feb 02 00:31:00 2012 +0200 @@ -140,7 +140,7 @@ user_log.user_ip = ipaddr sa.add(user_log) - log.info('Adding user %s, action %s on %s', user_obj, action, repo) + log.info('Adding user %s, action %s on %s' % (user_obj, action, repo)) if commit: sa.commit() except: @@ -261,12 +261,12 @@ if not os.path.isfile(path): log.warning('Unable to read config file %s' % path) return False - log.debug('reading hgrc from %s', path) + log.debug('reading hgrc from %s' % path) cfg = config.config() cfg.read(path) for section in ui_sections: for k, v in cfg.items(section): - log.debug('settings ui from file[%s]%s:%s', section, k, v) + log.debug('settings ui from file[%s]%s:%s' % (section, k, v)) baseui.setconfig(section, k, v) elif read_from == 'db': @@ -401,7 +401,7 @@ for name, repo in initial_repo_list.items(): group = map_groups(name.split(Repository.url_sep())) if not rm.get_by_repo_name(name, cache=False): - log.info('repository %s not found creating default', name) + log.info('repository %s not found creating default' % name) added.append(name) form_data = { 'repo_name': name, @@ -494,7 +494,7 @@ # PART ONE create db dbconf = config['sqlalchemy.db1.url'] - log.debug('making test db %s', dbconf) + log.debug('making test db %s' % dbconf) # create test dir if it doesn't exist if not os.path.isdir(repos_test_path): diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/model/__init__.py --- a/rhodecode/model/__init__.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/model/__init__.py Thu Feb 02 00:31:00 2012 +0200 @@ -56,7 +56,7 @@ :param engine: engine to bind to """ - log.info("initializing db for %s", engine) + log.info("initializing db for %s" % engine) meta.Base.metadata.bind = engine diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/model/db.py --- a/rhodecode/model/db.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/model/db.py Thu Feb 02 00:31:00 2012 +0200 @@ -366,7 +366,7 @@ """Update user lastlogin""" self.last_login = datetime.datetime.now() Session.add(self) - log.debug('updated user %s lastlogin', self.username) + log.debug('updated user %s lastlogin' % self.username) def __json__(self): return dict( @@ -682,7 +682,7 @@ repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository', alias) + log.debug('Creating instance of %s repository' % alias) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/model/forms.py --- a/rhodecode/model/forms.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/model/forms.py Thu Feb 02 00:31:00 2012 +0200 @@ -248,7 +248,7 @@ return value else: if user and user.active is False: - log.warning('user %s is disabled', username) + log.warning('user %s is disabled' % username) raise formencode.Invalid( self.message('disabled_account', state=State_obj), @@ -256,7 +256,7 @@ error_dict=self.e_dict_disable ) else: - log.warning('user %s not authenticated', username) + log.warning('user %s not authenticated' % username) raise formencode.Invalid( self.message('invalid_password', state=State_obj), value, state, diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/model/repo.py --- a/rhodecode/model/repo.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/model/repo.py Thu Feb 02 00:31:00 2012 +0200 @@ -401,7 +401,7 @@ :param old: old name :param new: new name """ - log.info('renaming repo from %s to %s', old, new) + log.info('renaming repo from %s to %s' % (old, new)) old_path = os.path.join(self.repos_path, old) new_path = os.path.join(self.repos_path, new) @@ -420,7 +420,7 @@ :param repo: repo object """ rm_path = os.path.join(self.repos_path, repo.repo_name) - log.info("Removing %s", rm_path) + log.info("Removing %s" % (rm_path)) # disable hg/git alias = repo.repo_type shutil.move(os.path.join(rm_path, '.%s' % alias), diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/model/repos_group.py --- a/rhodecode/model/repos_group.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/model/repos_group.py Thu Feb 02 00:31:00 2012 +0200 @@ -58,7 +58,7 @@ """ create_path = os.path.join(self.repos_path, group_name) - log.debug('creating new group in %s', create_path) + log.debug('creating new group in %s' % create_path) if os.path.isdir(create_path): raise Exception('That directory already exists !') @@ -76,13 +76,12 @@ log.debug('skipping group rename') return - log.debug('renaming repos group from %s to %s', old, new) - + log.debug('renaming repos group from %s to %s' % (old, new)) old_path = os.path.join(self.repos_path, old) new_path = os.path.join(self.repos_path, new) - log.debug('renaming repos paths from %s to %s', old_path, new_path) + log.debug('renaming repos paths from %s to %s' % (old_path, new_path)) if os.path.isdir(new_path): raise Exception('Was trying to rename to already ' diff -r 9c5b33c4de4d -r a76e9bacbedc rhodecode/model/user.py --- a/rhodecode/model/user.py Sun Feb 05 19:10:08 2012 +0200 +++ b/rhodecode/model/user.py Thu Feb 02 00:31:00 2012 +0200 @@ -110,13 +110,13 @@ from rhodecode.lib.auth import get_crypt_password - log.debug('Checking for %s account in RhodeCode database', username) + log.debug('Checking for %s account in RhodeCode database' % username) user = User.get_by_username(username, case_insensitive=True) if user is None: - log.debug('creating new user %s', username) + log.debug('creating new user %s' % username) new_user = User() else: - log.debug('updating user %s', username) + log.debug('updating user %s' % username) new_user = user try: @@ -327,7 +327,7 @@ dbuser = self.get(user_id) if dbuser is not None and dbuser.active: - log.debug('filling %s data', dbuser) + log.debug('filling %s data' % dbuser) for k, v in dbuser.get_dict().items(): setattr(auth_user, k, v) else: