# HG changeset patch # User Mads Kiilerich # Date 1439080186 -7200 # Node ID 0210d0b769d4c90da8ff8e7e7dccdc7c2264e4de # Parent d69aa464f373925e6148dd93d416bf5a34b6e5c7 cleanup: pass log strings unformatted - avoid unnecessary % formatting when not logging diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/admin/admin.py --- a/kallithea/controllers/admin/admin.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/admin/admin.py Sun Aug 09 02:29:46 2015 +0200 @@ -54,13 +54,13 @@ :param user_log: :param search_term: """ - log.debug('Initial search term: %r' % search_term) + log.debug('Initial search term: %r', search_term) qry = None if search_term: qp = QueryParser('repository', schema=JOURNAL_SCHEMA) qp.add_plugin(DateParserPlugin()) qry = qp.parse(unicode(search_term)) - log.debug('Filtering using parsed query %r' % qry) + log.debug('Filtering using parsed query %r', qry) def wildcard_handler(col, wc_term): if wc_term.startswith('*') and not wc_term.endswith('*'): @@ -85,7 +85,7 @@ field = getattr(UserLog, 'username') else: field = getattr(UserLog, field) - log.debug('filter field: %s val=>%s' % (field, val)) + log.debug('filter field: %s val=>%s', field, val) #sql filtering if isinstance(term, query.Wildcard): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/admin/auth_settings.py --- a/kallithea/controllers/admin/auth_settings.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/admin/auth_settings.py Sun Aug 09 02:29:46 2015 +0200 @@ -128,7 +128,7 @@ if k == 'auth_plugins': # we want to store it comma separated inside our settings v = ','.join(v) - log.debug("%s = %s" % (k, str(v))) + log.debug("%s = %s", k, str(v)) setting = Setting.create_or_update(k, v) Session().add(setting) Session().commit() diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/admin/gists.py --- a/kallithea/controllers/admin/gists.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/admin/gists.py Sun Aug 09 02:29:46 2015 +0200 @@ -196,8 +196,8 @@ #check if this gist is not expired if c.gist.gist_expires != -1: if time.time() > c.gist.gist_expires: - log.error('Gist expired at %s' % - (time_to_datetime(c.gist.gist_expires))) + log.error('Gist expired at %s', + time_to_datetime(c.gist.gist_expires)) raise HTTPNotFound() try: c.file_changeset, c.files = GistModel().get_gist_files(gist_id, @@ -221,8 +221,8 @@ #check if this gist is not expired if c.gist.gist_expires != -1: if time.time() > c.gist.gist_expires: - log.error('Gist expired at %s' % - (time_to_datetime(c.gist.gist_expires))) + log.error('Gist expired at %s', + time_to_datetime(c.gist.gist_expires)) raise HTTPNotFound() try: c.file_changeset, c.files = GistModel().get_gist_files(gist_id) @@ -285,8 +285,8 @@ ##TODO: maybe move this to model ? if revision != last_rev.raw_id: - log.error('Last revision %s is different than submitted %s' - % (revision, last_rev)) + log.error('Last revision %s is different than submitted %s', + revision, last_rev) # our gist has newer version than we success = False diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/admin/settings.py --- a/kallithea/controllers/admin/settings.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/admin/settings.py Sun Aug 09 02:29:46 2015 +0200 @@ -497,7 +497,7 @@ try: import kallithea ver = kallithea.__version__ - log.debug('Checking for upgrade on `%s` server' % _update_url) + log.debug('Checking for upgrade on `%s` server', _update_url) opener = urllib2.build_opener() opener.addheaders = [('User-agent', 'Kallithea-SCM/%s' % ver)] response = opener.open(_update_url) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/api/__init__.py --- a/kallithea/controllers/api/__init__.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/api/__init__.py Sun Aug 09 02:29:46 2015 +0200 @@ -117,7 +117,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") @@ -144,8 +144,8 @@ self._request_params = {} log.debug( - 'method: %s, params: %s' % (self._req_method, - self._request_params) + 'method: %s, params: %s', self._req_method, + self._request_params ) except KeyError as e: return jsonrpc_error(retid=self._req_id, @@ -163,7 +163,7 @@ return jsonrpc_error(retid=self._req_id, message='request from IP:%s not allowed' % (ip_addr,)) else: - log.info('Access for IP:%s allowed' % (ip_addr,)) + log.info('Access for IP:%s allowed', ip_addr) except Exception as e: return jsonrpc_error(retid=self._req_id, @@ -261,8 +261,8 @@ except JSONRPCError as e: self._error = safe_str(e) except Exception as e: - log.error('Encountered unhandled exception: %s' - % (traceback.format_exc(),)) + log.error('Encountered unhandled exception: %s', + traceback.format_exc(),) json_exc = JSONRPCError('Internal server error') self._error = safe_str(json_exc) @@ -273,7 +273,7 @@ try: return json.dumps(response) except TypeError as e: - log.error('API FAILED. Error encoding response: %s' % e) + log.error('API FAILED. Error encoding response: %s', e) return json.dumps( dict( id=self._req_id, @@ -286,7 +286,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 d69aa464f373 -r 0210d0b769d4 kallithea/controllers/changelog.py --- a/kallithea/controllers/changelog.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/changelog.py Sun Aug 09 02:29:46 2015 +0200 @@ -129,7 +129,7 @@ try: if f_path: - log.debug('generating changelog for path %s' % f_path) + log.debug('generating changelog for path %s', f_path) # get the history for the file ! tip_cs = c.db_repo_scm_instance.get_changeset() try: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/compare.py --- a/kallithea/controllers/compare.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/compare.py Sun Aug 09 02:29:46 2015 +0200 @@ -246,8 +246,8 @@ # case we want a simple diff without incoming changesets, # previewing what will be merged. # Make the diff on the other repo (which is known to have other_rev) - log.debug('Using ancestor %s as rev1 instead of %s' - % (c.ancestor, c.a_rev)) + log.debug('Using ancestor %s as rev1 instead of %s', + c.ancestor, c.a_rev) rev1 = c.ancestor org_repo = other_repo else: # comparing tips, not necessarily linearly related @@ -262,8 +262,8 @@ diff_limit = self.cut_off_limit if not c.fulldiff else None - log.debug('running diff between %s and %s in %s' - % (rev1, c.cs_rev, org_repo.scm_instance.path)) + log.debug('running diff between %s and %s in %s', + rev1, c.cs_rev, org_repo.scm_instance.path) txtdiff = org_repo.scm_instance.get_diff(rev1=rev1, rev2=c.cs_rev, ignore_whitespace=ignore_whitespace, context=line_context) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/error.py --- a/kallithea/controllers/error.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/error.py Sun Aug 09 02:29:46 2015 +0200 @@ -57,7 +57,7 @@ resp = request.environ.get('pylons.original_response') c.site_name = config.get('title') - log.debug('### %s ###' % (resp and resp.status or 'no response')) + log.debug('### %s ###', resp and resp.status or 'no response') e = request.environ c.serv_p = r'%(protocol)s://%(host)s/' % { diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/files.py --- a/kallithea/controllers/files.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/files.py Sun Aug 09 02:29:46 2015 +0200 @@ -554,21 +554,21 @@ os.makedirs(archive_cache_dir) cached_archive_path = os.path.join(archive_cache_dir, archive_name) if os.path.isfile(cached_archive_path): - log.debug('Found cached archive in %s' % cached_archive_path) + log.debug('Found cached archive in %s', cached_archive_path) archive_path = cached_archive_path else: - log.debug('Archive %s is not yet cached' % (archive_name)) + log.debug('Archive %s is not yet cached', archive_name) if archive_path is None: # generate new archive fd, archive_path = tempfile.mkstemp() - log.debug('Creating new temp archive in %s' % archive_path) + log.debug('Creating new temp archive in %s', archive_path) with os.fdopen(fd, 'wb') as stream: cs.fill_archive(stream=stream, kind=fileformat, subrepos=subrepos) # stream (and thus fd) has been closed by cs.fill_archive if cached_archive_path is not None: # we generated the archive - move it to cache - log.debug('Storing new archive in %s' % cached_archive_path) + log.debug('Storing new archive in %s', cached_archive_path) shutil.move(archive_path, cached_archive_path) archive_path = cached_archive_path @@ -581,7 +581,7 @@ yield data stream.close() if archive_path != cached_archive_path: - log.debug('Destroying temp archive %s' % archive_path) + log.debug('Destroying temp archive %s', archive_path) os.remove(archive_path) action_logger(user=c.authuser, diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/login.py --- a/kallithea/controllers/login.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/login.py Sun Aug 09 02:29:46 2015 +0200 @@ -64,8 +64,8 @@ server_parsed = urlparse.urlparse(url.current()) allowed_schemes = ['http', 'https'] if parsed.scheme and parsed.scheme not in allowed_schemes: - log.error('Suspicious URL scheme detected %s for url %s' % - (parsed.scheme, parsed)) + log.error('Suspicious URL scheme detected %s for url %s', + parsed.scheme, parsed) return False if server_parsed.netloc != parsed.netloc: log.error('Suspicious NETLOC detected %s for url %s server url ' diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/pullrequests.py Sun Aug 09 02:29:46 2015 +0200 @@ -641,8 +641,8 @@ diff_limit = self.cut_off_limit if not c.fulldiff else None # we swap org/other ref since we run a simple diff on one repo - log.debug('running diff between %s and %s in %s' - % (c.a_rev, c.cs_rev, org_scm_instance.path)) + log.debug('running diff between %s and %s in %s', + c.a_rev, c.cs_rev, org_scm_instance.path) txtdiff = org_scm_instance.get_diff(rev1=safe_str(c.a_rev), rev2=safe_str(c.cs_rev), ignore_whitespace=ignore_whitespace, context=line_context) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/search.py --- a/kallithea/controllers/search.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/search.py Sun Aug 09 02:29:46 2015 +0200 @@ -77,8 +77,8 @@ 'path': SCHEMA }.get(c.cur_type, SCHEMA) - log.debug('IDX: %s' % index_name) - log.debug('SCHEMA: %s' % schema_defn) + log.debug('IDX: %s', index_name) + log.debug('SCHEMA: %s', schema_defn) if c.cur_query: cur_query = c.cur_query.lower() @@ -109,8 +109,8 @@ matcher = query.matcher(searcher) - log.debug('query: %s' % query) - log.debug('hl terms: %s' % highlight_items) + log.debug('query: %s', query) + log.debug('hl terms: %s', highlight_items) results = searcher.search(query) res_ln = len(results) c.runtime = '%s results (%.3f seconds)' % ( diff -r d69aa464f373 -r 0210d0b769d4 kallithea/controllers/summary.py --- a/kallithea/controllers/summary.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/controllers/summary.py Sun Aug 09 02:29:46 2015 +0200 @@ -87,7 +87,7 @@ if not isinstance(readme, FileNode): continue readme_file = f - log.debug('Found README file `%s` rendering...' % + log.debug('Found README file `%s` rendering...', readme_file) readme_data = renderer.render(readme.content, filename=f) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/auth.py --- a/kallithea/lib/auth.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/auth.py Sun Aug 09 02:29:46 2015 +0200 @@ -439,10 +439,10 @@ from kallithea import CONFIG whitelist = aslist(CONFIG.get('api_access_controllers_whitelist'), sep=',') - log.debug('whitelist of API access is: %s' % (whitelist)) + log.debug('whitelist of API access is: %s', whitelist) api_access_valid = controller_name in whitelist if api_access_valid: - log.debug('controller:%s is in API whitelist' % (controller_name)) + log.debug('controller:%s is in API whitelist', controller_name) else: msg = 'controller: %s is *NOT* in API whitelist' % (controller_name) if api_key: @@ -497,7 +497,7 @@ # Look up database user, if necessary. if user_id is not None: - log.debug('Auth User lookup by USER ID %s' % user_id) + log.debug('Auth User lookup by USER ID %s', user_id) dbuser = user_model.get(user_id) else: # Note: dbuser is allowed to be None. @@ -516,7 +516,7 @@ if not self.username: self.username = 'None' - log.debug('Auth User is now %s' % self) + log.debug('Auth User is now %s', self) def _fill_data(self, dbuser): """ @@ -615,7 +615,7 @@ allowed_ips = AuthUser.get_allowed_ips(user.user_id, cache=True, inherit_from_default=user.inherit_default_permissions) if check_ip_access(source_ip=ip_addr, allowed_ips=allowed_ips): - log.debug('IP:%s is in range of %s' % (ip_addr, allowed_ips)) + log.debug('IP:%s is in range of %s', ip_addr, allowed_ips) return True else: log.info('Access for IP:%s forbidden, ' @@ -716,7 +716,7 @@ p = url.current() if message: h.flash(h.literal(message), category='warning') - log.debug('Redirecting to login page, origin: %s' % p) + log.debug('Redirecting to login page, origin: %s', p) return redirect(url('login_home', came_from=p, **request.GET)) class LoginRequired(object): @@ -738,7 +738,7 @@ controller = fargs[0] user = controller.authuser loc = "%s:%s" % (controller.__class__.__name__, func.__name__) - log.debug('Checking access for user %s @ %s' % (user, loc)) + log.debug('Checking access for user %s @ %s', user, loc) if not AuthUser.check_ip_allowed(user, controller.ip_addr): return redirect_to_login(_('IP %s not allowed') % controller.ip_addr) @@ -749,15 +749,15 @@ # explicit controller is enabled or API is in our whitelist if self.api_access or allowed_api_access(loc, api_key=api_key): if api_key in user.api_keys: - log.info('user %s authenticated with API key ****%s @ %s' - % (user, api_key[-4:], loc)) + log.info('user %s authenticated with API key ****%s @ %s', + user, api_key[-4:], loc) return func(*fargs, **fkwargs) else: - log.warning('API key ****%s is NOT valid' % api_key[-4:]) + log.warning('API key ****%s is NOT valid', api_key[-4:]) return redirect_to_login(_('Invalid API key')) else: # controller does not allow API access - log.warning('API access to %s is not allowed' % loc) + log.warning('API access to %s is not allowed', loc) return abort(403) # CSRF protection - POSTs with session auth must contain correct token @@ -769,10 +769,10 @@ # regular user authentication if user.is_authenticated: - log.info('user %s authenticated with regular auth @ %s' % (user, loc)) + log.info('user %s authenticated with regular auth @ %s', user, loc) return func(*fargs, **fkwargs) else: - log.warning('user %s NOT authenticated with regular auth @ %s' % (user, loc)) + log.warning('user %s NOT authenticated with regular auth @ %s', user, loc) return redirect_to_login() class NotAnonymous(object): @@ -787,7 +787,7 @@ cls = fargs[0] self.user = cls.authuser - log.debug('Checking if user is not anonymous @%s' % cls) + log.debug('Checking if user is not anonymous @%s', cls) anonymous = self.user.username == User.DEFAULT_USER @@ -813,14 +813,14 @@ self.user = cls.authuser self.user_perms = self.user.permissions log.debug('checking %s permissions %s for %s %s', - self.__class__.__name__, self.required_perms, cls, self.user) + self.__class__.__name__, self.required_perms, cls, 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.debug('Permission denied for %s %s' % (cls, self.user)) + log.debug('Permission denied for %s %s', cls, self.user) anonymous = self.user.username == User.DEFAULT_USER if anonymous: @@ -1003,15 +1003,15 @@ return False self.user_perms = user.permissions if self.check_permissions(): - log.debug('Permission to %s granted for user: %s @ %s' - % (check_scope, user, - check_location or 'unspecified location')) + log.debug('Permission to %s granted for user: %s @ %s', + check_scope, user, + check_location or 'unspecified location') return True else: - log.debug('Permission to %s denied for user: %s @ %s' - % (check_scope, user, - check_location or 'unspecified location')) + log.debug('Permission to %s denied for user: %s @ %s', + check_scope, user, + check_location or 'unspecified location') return False def check_permissions(self): @@ -1163,11 +1163,11 @@ 'permissions %s for user:%s repository:%s', self.user_perms, self.username, self.repo_name) if self.required_perms.intersection(self.user_perms): - log.debug('Permission to repo: %s granted for user: %s @ %s' - % (self.repo_name, self.username, 'PermissionMiddleware')) + log.debug('Permission to repo: %s granted for user: %s @ %s', + self.repo_name, self.username, 'PermissionMiddleware') return True - log.debug('Permission to repo: %s denied for user: %s @ %s' - % (self.repo_name, self.username, 'PermissionMiddleware')) + log.debug('Permission to repo: %s denied for user: %s @ %s', + self.repo_name, self.username, 'PermissionMiddleware') return False @@ -1188,8 +1188,8 @@ if group_name: check_scope += ', repo group:%s' % (group_name) - log.debug('checking cls:%s %s %s @ %s' - % (cls_name, self.required_perms, check_scope, check_location)) + log.debug('checking cls:%s %s %s @ %s', + cls_name, self.required_perms, check_scope, check_location) if not user: log.debug('Empty User passed into arguments') return False @@ -1200,13 +1200,13 @@ if not check_location: check_location = 'unspecified' if self.check_permissions(user.permissions, repo_name, group_name): - log.debug('Permission to %s granted for user: %s @ %s' - % (check_scope, user, check_location)) + log.debug('Permission to %s granted for user: %s @ %s', + check_scope, user, check_location) return True else: - log.debug('Permission to %s denied for user: %s @ %s' - % (check_scope, user, check_location)) + log.debug('Permission to %s denied for user: %s @ %s', + check_scope, user, check_location) return False def check_permissions(self, perm_defs, repo_name=None, group_name=None): @@ -1288,11 +1288,11 @@ :param allowed_ips: list of allowed ips together with mask """ from kallithea.lib import ipaddr - log.debug('checking if ip:%s is subnet of %s' % (source_ip, allowed_ips)) + log.debug('checking if ip:%s is subnet of %s', source_ip, allowed_ips) if isinstance(allowed_ips, (tuple, list, set)): for ip in allowed_ips: if ipaddr.IPAddress(source_ip) in ipaddr.IPNetwork(ip): - log.debug('IP %s is network %s' % - (ipaddr.IPAddress(source_ip), ipaddr.IPNetwork(ip))) + log.debug('IP %s is network %s', + ipaddr.IPAddress(source_ip), ipaddr.IPNetwork(ip)) return True return False diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/auth_modules/__init__.py --- a/kallithea/lib/auth_modules/__init__.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/auth_modules/__init__.py Sun Aug 09 02:29:46 2015 +0200 @@ -74,7 +74,7 @@ def __call__(self, *args, **kwargs): from kallithea.model import validators as v obj = getattr(v, self.validator_name) - #log.debug('Initializing lazy formencode object: %s' % obj) + #log.debug('Initializing lazy formencode object: %s', obj) return LazyFormencode(obj, *args, **kwargs) @@ -120,8 +120,8 @@ return False if user and user.extern_type and user.extern_type != plugin_name: - log.debug('User %s should authenticate using %s this is %s, skipping' - % (user, user.extern_type, plugin_name)) + log.debug('User %s should authenticate using %s this is %s, skipping', + user, user.extern_type, plugin_name) return False return True @@ -136,15 +136,15 @@ :param kwargs: extra arguments needed for user fetching. """ user = None - log.debug('Trying to fetch user `%s` from Kallithea database' - % (username)) + log.debug('Trying to fetch user `%s` from Kallithea database', + username) if username: user = User.get_by_username(username) if not user: log.debug('Fallback to fetch user in case insensitive mode') user = User.get_by_username(username, case_insensitive=True) else: - log.debug('provided username:`%s` is empty skipping...' % username) + log.debug('provided username:`%s` is empty skipping...', username) return user def settings(self): @@ -267,8 +267,8 @@ # external authentication, but if it's inactive user we shouldn't # create that user anyway if user_data['active_from_extern'] is False: - log.warning("User %s authenticated against %s, but is inactive" - % (username, self.__module__)) + log.warning("User %s authenticated against %s, but is inactive", + username, self.__module__) return None if self.use_fake_password(): @@ -276,8 +276,8 @@ # them blank either passwd = PasswordGenerator().gen_password(length=8) - log.debug('Updating or creating user info from %s plugin' - % self.name) + log.debug('Updating or creating user info from %s plugin', + self.name) user = UserModel().create_or_update( username=username, password=passwd, @@ -309,7 +309,7 @@ TypeError -- if the KallitheaAuthPlugin is not a subclass of ours KallitheaAuthPluginBase ImportError -- if we couldn't import the plugin at all """ - log.debug("Importing %s" % plugin) + log.debug("Importing %s", plugin) if not plugin.startswith(u'kallithea.lib.auth_modules.auth_'): parts = plugin.split(u'.lib.auth_modules.auth_', 1) if len(parts) == 2: @@ -326,8 +326,8 @@ # the plugin name, the crash is pretty bad and hard to recover raise - log.debug("Loaded auth plugin from %s (module:%s, file:%s)" - % (plugin, module.__name__, module.__file__)) + log.debug("Loaded auth plugin from %s (module:%s, file:%s)", + plugin, module.__name__, module.__file__) pluginclass = getattr(module, PLUGIN_CLASS_NAME) if not issubclass(pluginclass, KallitheaAuthPluginBase): @@ -362,14 +362,14 @@ """ auth_plugins = Setting.get_auth_plugins() - log.debug('Authentication against %s plugins' % (auth_plugins,)) + log.debug('Authentication against %s plugins', auth_plugins) for module in auth_plugins: try: plugin = loadplugin(module) except (ImportError, AttributeError, TypeError) as e: raise ImportError('Failed to load authentication module %s : %s' % (module, str(e))) - log.debug('Trying authentication using ** %s **' % (module,)) + log.debug('Trying authentication using ** %s **', module) # load plugin settings from Kallithea database plugin_name = plugin.name plugin_settings = {} @@ -377,26 +377,26 @@ conf_key = "auth_%s_%s" % (plugin_name, v["name"]) setting = Setting.get_by_name(conf_key) plugin_settings[v["name"]] = setting.app_settings_value if setting else None - log.debug('Plugin settings \n%s' % formatted_json(plugin_settings)) + log.debug('Plugin settings \n%s', formatted_json(plugin_settings)) if not str2bool(plugin_settings["enabled"]): - log.info("Authentication plugin %s is disabled, skipping for %s" - % (module, username)) + log.info("Authentication plugin %s is disabled, skipping for %s", + module, username) continue # use plugin's method of user extraction. user = plugin.get_user(username, environ=environ, settings=plugin_settings) - log.debug('Plugin %s extracted user is `%s`' % (module, user)) + log.debug('Plugin %s extracted user is `%s`', module, user) if not plugin.accepts(user): - log.debug('Plugin %s does not accept user `%s` for authentication' - % (module, user)) + log.debug('Plugin %s does not accept user `%s` for authentication', + module, user) continue else: - log.debug('Plugin %s accepted user `%s` for authentication' - % (module, user)) + log.debug('Plugin %s accepted user `%s` for authentication', + module, user) - log.info('Authenticating user using %s plugin' % plugin.__module__) + log.info('Authenticating user using %s plugin', plugin.__module__) # _authenticate is a wrapper for .auth() method of plugin. # it checks if .auth() sends proper data. For KallitheaExternalAuthPlugin # it also maps users to Database and maps the attributes returned @@ -405,7 +405,7 @@ user_data = plugin._authenticate(user, username, password, plugin_settings, environ=environ or {}) - log.debug('PLUGIN USER DATA: %s' % user_data) + log.debug('PLUGIN USER DATA: %s', user_data) if user_data is not None: log.debug('Plugin returned proper authentication data') @@ -413,8 +413,8 @@ # we failed to Auth because .auth() method didn't return the user if username: - log.warning("User `%s` failed to authenticate against %s" - % (username, plugin.__module__)) + log.warning("User `%s` failed to authenticate against %s", + username, plugin.__module__) return None def get_managed_fields(user): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/auth_modules/auth_container.py --- a/kallithea/lib/auth_modules/auth_container.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/auth_modules/auth_container.py Sun Aug 09 02:29:46 2015 +0200 @@ -95,24 +95,24 @@ username = None environ = environ or {} if not environ: - log.debug('got empty environ: %s' % environ) + log.debug('got empty environ: %s', environ) settings = settings or {} if settings.get('header'): header = settings.get('header') username = environ.get(header) - log.debug('extracted %s:%s' % (header, username)) + log.debug('extracted %s:%s', header, username) # fallback mode if not username and settings.get('fallback_header'): header = settings.get('fallback_header') username = environ.get(header) - log.debug('extracted %s:%s' % (header, username)) + log.debug('extracted %s:%s', header, username) if username and str2bool(settings.get('clean_username')): - log.debug('Received username %s from container' % username) + log.debug('Received username %s from container', username) username = self._clean_username(username) - log.debug('New cleanup user is: %s' % username) + log.debug('New cleanup user is: %s', username) return username def get_user(self, username=None, **kwargs): @@ -188,7 +188,7 @@ 'extern_name': username, } - log.info('user `%s` authenticated correctly' % user_data['username']) + log.info('user `%s` authenticated correctly', user_data['username']) return user_data def get_managed_fields(self): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/auth_modules/auth_crowd.py --- a/kallithea/lib/auth_modules/auth_crowd.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/auth_modules/auth_crowd.py Sun Aug 09 02:29:46 2015 +0200 @@ -85,9 +85,9 @@ _headers["Authorization"] = "Basic %s" % authstring if headers: _headers.update(headers) - log.debug("Sent crowd: \n%s" - % (formatted_json({"url": url, "body": body, - "headers": _headers}))) + log.debug("Sent crowd: \n%s", + formatted_json({"url": url, "body": body, + "headers": _headers})) request = urllib2.Request(url, body, _headers) if method: request.get_method = lambda: method @@ -202,16 +202,16 @@ log.debug('Empty username or password skipping...') return None - log.debug("Crowd settings: \n%s" % (formatted_json(settings))) + log.debug("Crowd settings: \n%s", formatted_json(settings)) server = CrowdServer(**settings) server.set_credentials(settings["app_name"], settings["app_password"]) crowd_user = server.user_auth(username, password) - log.debug("Crowd returned: \n%s" % (formatted_json(crowd_user))) + log.debug("Crowd returned: \n%s", formatted_json(crowd_user)) if not crowd_user["status"]: return None res = server.user_groups(crowd_user["name"]) - log.debug("Crowd groups: \n%s" % (formatted_json(res))) + log.debug("Crowd groups: \n%s", formatted_json(res)) crowd_user["groups"] = [x["name"] for x in res["groups"]] # old attrs fetched from Kallithea database @@ -237,8 +237,8 @@ for group in settings["admin_groups"].split(","): if group in user_data["groups"]: user_data["admin"] = True - log.debug("Final crowd user object: \n%s" % (formatted_json(user_data))) - log.info('user %s authenticated correctly' % user_data['username']) + log.debug("Final crowd user object: \n%s", formatted_json(user_data)) + log.info('user %s authenticated correctly', user_data['username']) return user_data def get_managed_fields(self): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/auth_modules/auth_internal.py --- a/kallithea/lib/auth_modules/auth_internal.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/auth_modules/auth_internal.py Sun Aug 09 02:29:46 2015 +0200 @@ -61,11 +61,11 @@ def auth(self, userobj, username, password, settings, **kwargs): if not userobj: - log.debug('userobj was:%s skipping' % (userobj, )) + log.debug('userobj was:%s skipping', userobj) return None if userobj.extern_type != self.name: - log.warning("userobj:%s extern_type mismatch got:`%s` expected:`%s`" - % (userobj, userobj.extern_type, self.name)) + log.warning("userobj:%s extern_type mismatch got:`%s` expected:`%s`", + userobj, userobj.extern_type, self.name) return None user_data = { @@ -85,17 +85,17 @@ from kallithea.lib import auth password_match = auth.KallitheaCrypto.hash_check(password, userobj.password) if userobj.username == User.DEFAULT_USER and userobj.active: - log.info('user %s authenticated correctly as anonymous user' % + log.info('user %s authenticated correctly as anonymous user', username) return user_data elif userobj.username == username and password_match: - log.info('user %s authenticated correctly' % user_data['username']) + log.info('user %s authenticated correctly', user_data['username']) return user_data - log.error("user %s had a bad password" % username) + log.error("user %s had a bad password", username) return None else: - log.warning('user %s tried auth but is disabled' % username) + log.warning('user %s tried auth but is disabled', username) return None def get_managed_fields(self): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/auth_modules/auth_ldap.py --- a/kallithea/lib/auth_modules/auth_ldap.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/auth_modules/auth_ldap.py Sun Aug 09 02:29:46 2015 +0200 @@ -127,8 +127,8 @@ server.start_tls_s() if self.LDAP_BIND_DN and self.LDAP_BIND_PASS: - log.debug('Trying simple_bind with password and given DN: %s' - % self.LDAP_BIND_DN) + log.debug('Trying simple_bind with password and given DN: %s', + self.LDAP_BIND_DN) server.simple_bind_s(self.LDAP_BIND_DN, self.LDAP_BIND_PASS) filter_ = '(&%s(%s=%s))' % (self.LDAP_FILTER, self.attr_login, @@ -146,15 +146,15 @@ continue try: - log.debug('Trying simple bind with %s' % dn) + log.debug('Trying simple bind with %s', dn) server.simple_bind_s(dn, safe_str(password)) attrs = server.search_ext_s(dn, ldap.SCOPE_BASE, '(objectClass=*)')[0][1] 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 " @@ -162,7 +162,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 authentication server") @@ -328,7 +328,7 @@ try: 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(settings.get(k), [''])[0] @@ -350,7 +350,7 @@ "active_from_extern": None, 'extern_name': user_dn, } - log.info('user %s authenticated correctly' % user_data['username']) + log.info('user %s authenticated correctly', user_data['username']) return user_data except (LdapUsernameError, LdapPasswordError, LdapImportError): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/auth_modules/auth_pam.py --- a/kallithea/lib/auth_modules/auth_pam.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/auth_modules/auth_pam.py Sun Aug 09 02:29:46 2015 +0200 @@ -98,10 +98,10 @@ _pam_lock.release() if not auth_result: - log.error("PAM was unable to authenticate user: %s" % (username,)) + log.error("PAM was unable to authenticate user: %s", username) return None else: - log.debug("Using cached auth for user: %s" % (username,)) + log.debug("Using cached auth for user: %s", username) # old attrs fetched from Kallithea database admin = getattr(userobj, 'admin', False) @@ -133,8 +133,8 @@ log.warning("Cannot extract additional info for PAM user %s", username) pass - log.debug("pamuser: \n%s" % formatted_json(user_data)) - log.info('user %s authenticated correctly' % user_data['username']) + log.debug("pamuser: \n%s", formatted_json(user_data)) + log.info('user %s authenticated correctly', user_data['username']) return user_data def get_managed_fields(self): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/base.py --- a/kallithea/lib/base.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/base.py Sun Aug 09 02:29:46 2015 +0200 @@ -74,7 +74,7 @@ if ',' in ip: _ips = ip.split(',') _first_ip = _ips[0].strip() - log.debug('Got multiple IPs %s, using %s' % (','.join(_ips), _first_ip)) + log.debug('Got multiple IPs %s, using %s', ','.join(_ips), _first_ip) return _first_ip return ip @@ -224,7 +224,7 @@ # check IP ip_allowed = AuthUser.check_ip_allowed(user, ip_addr) if ip_allowed: - log.info('Access for IP:%s allowed' % (ip_addr,)) + log.info('Access for IP:%s allowed', ip_addr) else: return False @@ -256,8 +256,8 @@ if str2bool(Ui.get_by_key('push_ssl').ui_value): org_proto = environ.get('wsgi._org_proto', environ['wsgi.url_scheme']) if org_proto != 'https': - log.debug('proto is %s and SSL is required BAD REQUEST !' - % org_proto) + log.debug('proto is %s and SSL is required BAD REQUEST !', + org_proto) return False return True @@ -286,7 +286,7 @@ #check if it's already locked !, if it is compare users user_id, _date = repo.locked if user.user_id == user_id: - log.debug('Got push from user %s, now unlocking' % (user)) + log.debug('Got push from user %s, now unlocking', user) # unlock if we have push from user who locked make_lock = False else: @@ -296,13 +296,13 @@ if repo.locked[0] and repo.locked[1]: locked = True else: - log.debug('Setting lock on repo %s by %s' % (repo, user)) + log.debug('Setting lock on repo %s by %s', repo, user) make_lock = True else: - log.debug('Repository %s do not have locking enabled' % (repo)) - log.debug('FINAL locking values make_lock:%s,locked:%s,locked_by:%s' - % (make_lock, locked, locked_by)) + log.debug('Repository %s do not have locking enabled', repo) + log.debug('FINAL locking values make_lock:%s,locked:%s,locked_by:%s', + make_lock, locked, locked_by) return make_lock, locked, locked_by def __call__(self, environ, start_response): @@ -311,7 +311,7 @@ return self._handle_request(environ, start_response) finally: log = logging.getLogger('kallithea.' + self.__class__.__name__) - log.debug('Request time: %.3fs' % (time.time() - start)) + log.debug('Request time: %.3fs', time.time() - start) meta.Session.remove() @@ -466,8 +466,8 @@ if not _dbr: return - log.debug('Found repository in database %s with state `%s`' - % (safe_unicode(_dbr), safe_unicode(_dbr.repo_state))) + log.debug('Found repository in database %s with state `%s`', + safe_unicode(_dbr), safe_unicode(_dbr.repo_state)) route = getattr(request.environ.get('routes.route'), 'name', '') # allow to delete repos that are somehow damages in filesystem diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/celerylib/__init__.py --- a/kallithea/lib/celerylib/__init__.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/celerylib/__init__.py Sun Aug 09 02:29:46 2015 +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 as e: @@ -76,7 +76,7 @@ except Exception as 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)) @@ -96,7 +96,7 @@ lockkey = __get_lockkey(func, *fargs, **fkwargs) lockkey_path = config['app_conf']['cache_dir'] - 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 d69aa464f373 -r 0210d0b769d4 kallithea/lib/celerylib/tasks.py --- a/kallithea/lib/celerylib/tasks.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/celerylib/tasks.py Sun Aug 09 02:29:46 2015 +0200 @@ -87,7 +87,7 @@ ts_max_y) lockkey_path = config['app_conf']['cache_dir'] - 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)) @@ -134,15 +134,15 @@ 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 - log.debug('Getting revisions from %s to %s' % ( - last_rev, last_rev + parse_limit) + log.debug('Getting revisions from %s to %s', + last_rev, last_rev + parse_limit ) for cs in repo[last_rev:last_rev + parse_limit]: - log.debug('parsing %s' % cs) + log.debug('parsing %s', cs) last_cs = cs # remember last parsed changeset k = lmktime([cs.date.timetuple()[0], cs.date.timetuple()[1], cs.date.timetuple()[2], 0, 0, 0, 0, 0, 0]) @@ -210,9 +210,9 @@ stats.commit_activity = json.dumps(co_day_auth_aggr) stats.commit_activity_combined = json.dumps(overview_data) - log.debug('last revision %s' % last_rev) + log.debug('last revision %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') diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/db_manage.py --- a/kallithea/lib/db_manage.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/db_manage.py Sun Aug 09 02:29:46 2015 +0200 @@ -103,7 +103,7 @@ checkfirst = not override 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() @@ -111,7 +111,7 @@ ver.repository_id = 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): """ @@ -363,7 +363,7 @@ for k, v, t in [('auth_plugins', 'kallithea.lib.auth_modules.auth_internal', 'list'), ('auth_internal_enabled', 'True', 'bool')]: if skip_existing and Setting.get_by_name(k) != None: - log.debug('Skipping option %s' % k) + log.debug('Skipping option %s', k) continue setting = Setting(k, v, t) self.sa.add(setting) @@ -379,7 +379,7 @@ ('default_repo_type', 'hg', 'unicode')]: if skip_existing and Setting.get_by_name(k) is not None: - log.debug('Skipping option %s' % k) + log.debug('Skipping option %s', k) continue setting = Setting(k, v, t) self.sa.add(setting) @@ -396,7 +396,7 @@ .scalar() if default is None: - log.debug('missing default permission for group %s adding' % g) + log.debug('missing default permission for group %s adding', g) perm_obj = RepoGroupModel()._create_default_perms(g) self.sa.add(perm_obj) @@ -444,20 +444,20 @@ # 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) elif not os.path.isabs(path): path_ok = False - log.error('Given path %s is not an absolute path' % (path,)) + log.error('Given path %s is not an absolute path', path) # check if path is at least readable. if not os.access(path, os.R_OK): path_ok = False - log.error('Given path %s is not readable' % (path,)) + log.error('Given path %s is not readable', path) # check write access, warn user about non writeable paths elif not os.access(path, os.W_OK) and path_ok: - log.warning('No write permission to given path %s' % (path,)) + log.warning('No write permission to given path %s', path) if not ask_ok('Given path %s is not writeable, do you want to ' 'continue with read only mode ? [y/n]' % (path,)): log.error('Canceled by user') @@ -472,7 +472,7 @@ real_path = os.path.normpath(os.path.realpath(path)) if real_path != os.path.normpath(path): - log.warning('Using normalized path %s instead of %s' % (real_path, path)) + log.warning('Using normalized path %s instead of %s', real_path, path) return real_path @@ -520,7 +520,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, firstname='Kallithea', lastname='Admin', active=True, admin=admin, diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/migrate/versioning/migrate_repository.py --- a/kallithea/lib/dbmigrate/migrate/versioning/migrate_repository.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/migrate/versioning/migrate_repository.py Sun Aug 09 02:29:46 2015 +0200 @@ -25,13 +25,13 @@ def delete_file(filepath): """Deletes a file and prints a message.""" - log.info('Deleting file: %s' % filepath) + log.info('Deleting file: %s', filepath) os.remove(filepath) def move_file(src, tgt): """Moves a file and prints a message.""" - log.info('Moving file %s to %s' % (src, tgt)) + log.info('Moving file %s to %s', src, tgt) if os.path.exists(tgt): raise Exception( 'Cannot move file %s because target %s already exists' % \ @@ -41,13 +41,13 @@ def delete_directory(dirpath): """Delete a directory and print a message.""" - log.info('Deleting directory: %s' % dirpath) + log.info('Deleting directory: %s', dirpath) os.rmdir(dirpath) def migrate_repository(repos): """Does the actual migration to the new repository format.""" - log.info('Migrating repository at: %s to new format' % repos) + log.info('Migrating repository at: %s to new format', repos) versions = '%s/versions' % repos dirs = os.listdir(versions) # Only use int's in list. @@ -55,7 +55,7 @@ numdirs.sort() # Sort list. for dirname in numdirs: origdir = '%s/%s' % (versions, dirname) - log.info('Working on directory: %s' % origdir) + log.info('Working on directory: %s', origdir) files = os.listdir(origdir) files.sort() for filename in files: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/migrate/versioning/pathed.py --- a/kallithea/lib/dbmigrate/migrate/versioning/pathed.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/migrate/versioning/pathed.py Sun Aug 09 02:29:46 2015 +0200 @@ -35,7 +35,7 @@ """Try to initialize this object's parent, if it has one""" parent_path = self.__class__._parent_path(path) self.parent = self.__class__.parent(parent_path) - log.debug("Getting parent %r:%r" % (self.__class__.parent, parent_path)) + log.debug("Getting parent %r:%r", self.__class__.parent, parent_path) self.parent._init_child(path, self) def _init_child(self, child, path): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/migrate/versioning/repository.py --- a/kallithea/lib/dbmigrate/migrate/versioning/repository.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/migrate/versioning/repository.py Sun Aug 09 02:29:46 2015 +0200 @@ -74,14 +74,14 @@ _versions = 'versions' def __init__(self, path): - log.debug('Loading repository %s...' % path) + log.debug('Loading repository %s...', path) self.verify(path) super(Repository, self).__init__(path) self.config = cfgparse.Config(os.path.join(self.path, self._config)) self.versions = version.Collection(os.path.join(self.path, self._versions)) - log.debug('Repository %s loaded successfully' % path) - log.debug('Config: %r' % self.config.to_dict()) + log.debug('Repository %s loaded successfully', path) + log.debug('Config: %r', self.config.to_dict()) @classmethod def verify(cls, path): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/migrate/versioning/script/base.py --- a/kallithea/lib/dbmigrate/migrate/versioning/script/base.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/migrate/versioning/script/base.py Sun Aug 09 02:29:46 2015 +0200 @@ -24,10 +24,10 @@ """ # TODO: sphinxfy this and implement it correctly def __init__(self, path): - log.debug('Loading script %s...' % path) + log.debug('Loading script %s...', path) self.verify(path) super(BaseScript, self).__init__(path) - log.debug('Script %s loaded successfully' % path) + log.debug('Script %s loaded successfully', path) @classmethod def verify(cls, path): diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_1_2_0.py --- a/kallithea/lib/dbmigrate/schema/db_1_2_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_1_2_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -323,7 +323,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): @@ -698,7 +698,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()) @@ -785,7 +785,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1060,7 +1060,7 @@ :param key: """ - log.debug('marking %s for invalidation' % key) + log.debug('marking %s for invalidation', key) inv_obj = Session.query(cls)\ .filter(cls.cache_key == key).scalar() if inv_obj: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_1_3_0.py --- a/kallithea/lib/dbmigrate/schema/db_1_3_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_1_3_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -391,7 +391,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( @@ -716,7 +716,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()) @@ -813,7 +813,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1151,8 +1151,8 @@ key, _prefix, _org_key = cls._get_key(key) inv_objs = Session.query(cls).filter(cls.cache_args == _org_key).all() - log.debug('marking %s key[s] %s for invalidation' % (len(inv_objs), - _org_key)) + log.debug('marking %s key[s] %s for invalidation', len(inv_objs), + _org_key) try: for inv_obj in inv_objs: if inv_obj: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_1_4_0.py --- a/kallithea/lib/dbmigrate/schema/db_1_4_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_1_4_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -437,7 +437,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 get_api_data(self): """ @@ -863,7 +863,7 @@ if last_change is None: last_change = datetime.datetime.now() if self.updated_on is None or self.updated_on != last_change: - log.debug('updated repo %s with new date %s' % (self, last_change)) + log.debug('updated repo %s with new date %s', self, last_change) self.updated_on = last_change Session().add(self) Session().commit() @@ -977,7 +977,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()) @@ -1081,7 +1081,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1505,8 +1505,8 @@ elif repo_name: inv_objs = Session().query(cls).filter(cls.cache_args == repo_name).all() - log.debug('marking %s key[s] for invalidation based on key=%s,repo_name=%s' - % (len(inv_objs), key, repo_name)) + log.debug('marking %s key[s] for invalidation based on key=%s,repo_name=%s', + len(inv_objs), key, repo_name) try: for inv_obj in inv_objs: inv_obj.cache_active = False diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_1_5_0.py --- a/kallithea/lib/dbmigrate/schema/db_1_5_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_1_5_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -455,7 +455,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 get_api_data(self): """ @@ -882,7 +882,7 @@ if last_change is None: last_change = datetime.datetime.now() if self.updated_on is None or self.updated_on != last_change: - log.debug('updated repo %s with new date %s' % (self, last_change)) + log.debug('updated repo %s with new date %s', self, last_change) self.updated_on = last_change Session().add(self) Session().commit() @@ -996,7 +996,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()) @@ -1100,7 +1100,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1532,8 +1532,8 @@ elif repo_name: inv_objs = Session().query(cls).filter(cls.cache_args == repo_name).all() - log.debug('marking %s key[s] for invalidation based on key=%s,repo_name=%s' - % (len(inv_objs), key, repo_name)) + log.debug('marking %s key[s] for invalidation based on key=%s,repo_name=%s', + len(inv_objs), key, repo_name) try: for inv_obj in inv_objs: inv_obj.cache_active = False diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_1_5_2.py --- a/kallithea/lib/dbmigrate/schema/db_1_5_2.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_1_5_2.py Sun Aug 09 02:29:46 2015 +0200 @@ -462,7 +462,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 get_api_data(self): """ @@ -995,15 +995,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1117,7 +1117,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()) @@ -1221,7 +1221,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1645,8 +1645,8 @@ elif repo_name: inv_objs = Session().query(cls).filter(cls.cache_args == repo_name).all() - log.debug('marking %s key[s] for invalidation based on key=%s,repo_name=%s' - % (len(inv_objs), key, repo_name)) + log.debug('marking %s key[s] for invalidation based on key=%s,repo_name=%s', + len(inv_objs), key, repo_name) try: for inv_obj in inv_objs: inv_obj.cache_active = False diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_1_6_0.py --- a/kallithea/lib/dbmigrate/schema/db_1_6_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_1_6_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -491,7 +491,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 get_api_data(self): """ @@ -1065,15 +1065,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1192,8 +1192,8 @@ repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1296,7 +1296,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1723,8 +1723,8 @@ try: for inv_obj in inv_objs: inv_obj.cache_active = False - log.debug('marking %s key for invalidation based on key=%s,repo_name=%s' - % (inv_obj, key, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on key=%s,repo_name=%s', + inv_obj, key, safe_str(repo_name)) invalidated_keys.append(inv_obj.cache_key) Session().add(inv_obj) Session().commit() diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_1_7_0.py --- a/kallithea/lib/dbmigrate/schema/db_1_7_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_1_7_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -493,7 +493,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) @classmethod def get_first_admin(cls): @@ -1096,15 +1096,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1199,18 +1199,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting obj for %s from cache' % (rn)) + log.debug('Getting obj for %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1314,7 +1314,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1828,8 +1828,8 @@ try: for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) inv_obj.cache_active = False Session().add(inv_obj) Session().commit() diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_1_8_0.py --- a/kallithea/lib/dbmigrate/schema/db_1_8_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_1_8_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -516,7 +516,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) @classmethod def get_first_admin(cls): @@ -1126,15 +1126,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1229,18 +1229,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting obj for %s from cache' % (rn)) + log.debug('Getting obj for %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1344,7 +1344,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1874,8 +1874,8 @@ try: for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) inv_obj.cache_active = False Session().add(inv_obj) Session().commit() diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_2_0_0.py --- a/kallithea/lib/dbmigrate/schema/db_2_0_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_2_0_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -568,7 +568,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) @classmethod def get_first_admin(cls): @@ -1183,15 +1183,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1286,18 +1286,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting obj for %s from cache' % (rn)) + log.debug('Getting obj for %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1401,7 +1401,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1931,8 +1931,8 @@ try: for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) if delete: Session().delete(inv_obj) else: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_2_0_1.py --- a/kallithea/lib/dbmigrate/schema/db_2_0_1.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_2_0_1.py Sun Aug 09 02:29:46 2015 +0200 @@ -568,7 +568,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) @classmethod def get_first_admin(cls): @@ -1182,15 +1182,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1285,18 +1285,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting obj for %s from cache' % (rn)) + log.debug('Getting obj for %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1402,7 +1402,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1932,8 +1932,8 @@ try: for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) if delete: Session().delete(inv_obj) else: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_2_0_2.py --- a/kallithea/lib/dbmigrate/schema/db_2_0_2.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_2_0_2.py Sun Aug 09 02:29:46 2015 +0200 @@ -568,7 +568,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) @classmethod def get_first_admin(cls): @@ -1202,15 +1202,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1305,18 +1305,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting obj for %s from cache' % (rn)) + log.debug('Getting obj for %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1423,7 +1423,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1953,8 +1953,8 @@ try: for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) if delete: Session().delete(inv_obj) else: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_2_1_0.py --- a/kallithea/lib/dbmigrate/schema/db_2_1_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_2_1_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -583,7 +583,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) @classmethod def get_first_admin(cls): @@ -1241,15 +1241,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1344,18 +1344,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting obj for %s from cache' % (rn)) + log.debug('Getting obj for %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1462,7 +1462,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -1992,8 +1992,8 @@ try: for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) if delete: Session().delete(inv_obj) else: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_2_2_0.py --- a/kallithea/lib/dbmigrate/schema/db_2_2_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_2_2_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -610,7 +610,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) @classmethod def get_first_admin(cls): @@ -1287,15 +1287,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1390,18 +1390,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting obj for %s from cache' % (rn)) + log.debug('Getting obj for %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1512,7 +1512,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -2042,11 +2042,11 @@ Mark all caches of a repo as invalid in the database. """ inv_objs = Session().query(cls).filter(cls.cache_args == repo_name).all() - log.debug('for repo %s got %s invalidation objects' % (repo_name, inv_objs)) + log.debug('for repo %s got %s invalidation objects', repo_name, inv_objs) try: for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) if delete: Session().delete(inv_obj) else: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/schema/db_2_2_3.py --- a/kallithea/lib/dbmigrate/schema/db_2_2_3.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/schema/db_2_2_3.py Sun Aug 09 02:29:46 2015 +0200 @@ -610,7 +610,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) @classmethod def get_first_admin(cls): @@ -1314,15 +1314,15 @@ if (cs_cache != self.changeset_cache or not self.changeset_cache): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('Skipping repo:%s already with latest changes' - % self.repo_name) + log.debug('Skipping repo:%s already with latest changes', + self.repo_name) @property def tip(self): @@ -1417,18 +1417,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting obj for %s from cache' % (rn)) + log.debug('Getting obj for %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) @@ -1539,7 +1539,7 @@ break if cnt == parents_recursion_limit: # this will prevent accidental infinite loops - log.error('group nested more than %s' % + log.error('group nested more than %s', parents_recursion_limit) break @@ -2087,12 +2087,12 @@ Mark all caches of a repo as invalid in the database. """ inv_objs = Session().query(cls).filter(cls.cache_args == repo_name).all() - log.debug('for repo %s got %s invalidation objects' - % (safe_str(repo_name), inv_objs)) + log.debug('for repo %s got %s invalidation objects', + safe_str(repo_name), inv_objs) try: for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) if delete: Session().delete(inv_obj) else: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/versions/001_initial_release.py --- a/kallithea/lib/dbmigrate/versions/001_initial_release.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/versions/001_initial_release.py Sun Aug 09 02:29:46 2015 +0200 @@ -76,7 +76,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 d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/versions/008_version_1_5_0.py --- a/kallithea/lib/dbmigrate/versions/008_version_1_5_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/versions/008_version_1_5_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -90,7 +90,7 @@ perms = models.UserToPerm.query().filter(models.UserToPerm.user == user).all() defined_perms_groups = map(_get_group, (x.permission.permission_name for x in perms)) - log.debug('GOT ALREADY DEFINED:%s' % perms) + log.debug('GOT ALREADY DEFINED:%s', perms) DEFAULT_PERMS = models.Permission.DEFAULT_USER_PERMISSIONS # for every default permission that needs to be created, we check if @@ -98,8 +98,8 @@ for perm_name in DEFAULT_PERMS: gr = _get_group(perm_name) if gr not in defined_perms_groups: - log.debug('GR:%s not found, creating permission %s' - % (gr, perm_name)) + log.debug('GR:%s not found, creating permission %s', + gr, perm_name) new_perm = _make_perm(perm_name) _SESSION().add(new_perm) _SESSION().commit() @@ -115,7 +115,7 @@ ('default_repo_type', 'hg')]: if skip_existing and models.Setting.get_by_name(k) is not None: - log.debug('Skipping option %s' % k) + log.debug('Skipping option %s', k) continue setting = models.Setting(k, v) _SESSION().add(setting) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/dbmigrate/versions/012_version_1_7_0.py --- a/kallithea/lib/dbmigrate/versions/012_version_1_7_0.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/dbmigrate/versions/012_version_1_7_0.py Sun Aug 09 02:29:46 2015 +0200 @@ -93,7 +93,7 @@ perms = models.UserToPerm.query().filter(models.UserToPerm.user == user).all() defined_perms_groups = map(_get_group, (x.permission.permission_name for x in perms)) - log.debug('GOT ALREADY DEFINED:%s' % perms) + log.debug('GOT ALREADY DEFINED:%s', perms) DEFAULT_PERMS = models.Permission.DEFAULT_USER_PERMISSIONS # for every default permission that needs to be created, we check if @@ -101,8 +101,8 @@ for perm_name in DEFAULT_PERMS: gr = _get_group(perm_name) if gr not in defined_perms_groups: - log.debug('GR:%s not found, creating permission %s' - % (gr, perm_name)) + log.debug('GR:%s not found, creating permission %s', + gr, perm_name) new_perm = _make_perm(perm_name) _SESSION().add(new_perm) _SESSION().commit() diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/helpers.py Sun Aug 09 02:29:46 2015 +0200 @@ -646,7 +646,7 @@ _rev = repo.get_changeset(rev) revs.append(_rev) except ChangesetDoesNotExistError: - log.error('cannot find revision %s in this repo' % rev) + log.error('cannot find revision %s in this repo', rev) revs.append(rev) else: _rev = AttributeDict({ @@ -1324,17 +1324,17 @@ ] if valid_indices: - log.debug('found issue server suffixes `%s` during valuation of: %s' - % (','.join(valid_indices), newtext)) + log.debug('found issue server suffixes `%s` during valuation of: %s', + ','.join(valid_indices), newtext) for pattern_index in valid_indices: ISSUE_PATTERN = conf.get('issue_pat%s' % pattern_index) ISSUE_SERVER_LNK = conf.get('issue_server_link%s' % pattern_index) ISSUE_PREFIX = conf.get('issue_prefix%s' % pattern_index) - log.debug('pattern suffix `%s` PAT:%s SERVER_LINK:%s PREFIX:%s' - % (pattern_index, ISSUE_PATTERN, ISSUE_SERVER_LNK, - ISSUE_PREFIX)) + log.debug('pattern suffix `%s` PAT:%s SERVER_LINK:%s PREFIX:%s', + pattern_index, ISSUE_PATTERN, ISSUE_SERVER_LNK, + ISSUE_PREFIX) URL_PAT = re.compile(ISSUE_PATTERN) @@ -1363,7 +1363,7 @@ 'serv': ISSUE_SERVER_LNK, } newtext = URL_PAT.sub(url_func, newtext) - log.debug('processed prefix:`%s` => %s' % (pattern_index, newtext)) + log.debug('processed prefix:`%s` => %s', pattern_index, newtext) # if we actually did something above if link_: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/indexers/__init__.py --- a/kallithea/lib/indexers/__init__.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/indexers/__init__.py Sun Aug 09 02:29:46 2015 +0200 @@ -138,7 +138,7 @@ def get_full_content(self, docid): res = self.searcher.stored_fields(docid[0]) - log.debug('result: %s' % res) + log.debug('result: %s', res) if self.search_type == 'content': full_repo_path = jn(self.repo_location, res['repository']) f_path = res['path'].split(full_repo_path)[-1] @@ -156,7 +156,7 @@ elif self.search_type == 'message': res.update({'message_hl': self.highlight(res['message'])}) - log.debug('result: %s' % res) + log.debug('result: %s', res) return res diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/indexers/daemon.py --- a/kallithea/lib/indexers/daemon.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/indexers/daemon.py Sun Aug 09 02:29:46 2015 +0200 @@ -182,11 +182,11 @@ 'replacing with empty content' % path) u_content = u'' else: - log.debug(' >> %s [WITH CONTENT]' % path) + log.debug(' >> %s [WITH CONTENT]', path) indexed_w_content += 1 else: - log.debug(' >> %s' % path) + log.debug(' >> %s', path) # just index file name without it's content u_content = u'' indexed += 1 @@ -221,14 +221,14 @@ if start_rev is None: start_rev = repo[0].raw_id - log.debug('indexing changesets in %s starting at rev: %s' % - (repo_name, start_rev)) + log.debug('indexing changesets in %s starting at rev: %s', + repo_name, start_rev) indexed = 0 cs_iter = repo.get_changesets(start=start_rev) total = len(cs_iter) for cs in cs_iter: - log.debug(' >> %s/%s' % (cs, total)) + log.debug(' >> %s/%s', cs, total) writer.add_document( raw_id=unicode(cs.raw_id), owner=unicode(repo.contact), @@ -244,7 +244,7 @@ ) indexed += 1 - log.debug('indexed %d changesets for repo %s' % (indexed, repo_name)) + log.debug('indexed %d changesets for repo %s', indexed, repo_name) return indexed def index_files(self, file_idx_writer, repo_name, repo): @@ -256,16 +256,16 @@ :param repo: instance of vcs repo """ i_cnt = iwc_cnt = 0 - log.debug('building index for %s @revision:%s' % (repo.path, - self._get_index_revision(repo))) + log.debug('building index for %s @revision:%s', repo.path, + self._get_index_revision(repo)) index_rev = self._get_index_revision(repo) for idx_path in self.get_paths(repo): i, iwc = self.add_doc(file_idx_writer, idx_path, repo, repo_name, index_rev) i_cnt += i iwc_cnt += iwc - log.debug('added %s files %s with content for repo %s' % - (i_cnt + iwc_cnt, iwc_cnt, repo.path)) + log.debug('added %s files %s with content for repo %s', + i_cnt + iwc_cnt, iwc_cnt, repo.path) return i_cnt, iwc_cnt def update_changeset_index(self): @@ -311,8 +311,8 @@ indexed_total += self.index_changesets(writer, repo_name, repo, start_id) writer_is_dirty = True - log.debug('indexed %s changesets for repo %s' % ( - indexed_total, repo_name) + log.debug('indexed %s changesets for repo %s', + indexed_total, repo_name ) finally: if writer_is_dirty: @@ -357,8 +357,8 @@ # The file has changed, delete it and add it to # the list of files to reindex log.debug( - 'adding to reindex list %s mtime: %s vs %s' % ( - indexed_path, mtime, indexed_time) + 'adding to reindex list %s mtime: %s vs %s', + indexed_path, mtime, indexed_time ) writer.delete_by_term('fileid', indexed_path) writer_is_dirty = True @@ -366,7 +366,7 @@ to_index.add(indexed_path) except (ChangesetError, NodeDoesNotExistError): # This file was deleted since it was indexed - log.debug('removing from index %s' % indexed_path) + log.debug('removing from index %s', indexed_path) writer.delete_by_term('path', indexed_path) writer_is_dirty = True @@ -389,16 +389,16 @@ # that wasn't indexed before. So index it! i, iwc = self.add_doc(writer, path, repo, repo_name) writer_is_dirty = True - log.debug('re indexing %s' % path) + log.debug('re indexing %s', path) ri_cnt += i ri_cnt_total += 1 riwc_cnt += iwc riwc_cnt_total += iwc - log.debug('added %s files %s with content for repo %s' % ( - ri_cnt + riwc_cnt, riwc_cnt, repo.path) + log.debug('added %s files %s with content for repo %s', + ri_cnt + riwc_cnt, riwc_cnt, repo.path ) - log.debug('indexed %s files in total and %s with content' % ( - ri_cnt_total, riwc_cnt_total) + log.debug('indexed %s files in total and %s with content', + ri_cnt_total, riwc_cnt_total ) finally: if writer_is_dirty: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/middleware/pygrack.py --- a/kallithea/lib/middleware/pygrack.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/middleware/pygrack.py Sun Aug 09 02:29:46 2015 +0200 @@ -69,7 +69,7 @@ git_command = request.GET.get('service') if git_command not in self.commands: - log.debug('command %s not allowed' % git_command) + log.debug('command %s not allowed', git_command) return exc.HTTPMethodNotAllowed() # note to self: @@ -108,7 +108,7 @@ _git_path = kallithea.CONFIG.get('git_path', 'git') git_command = self._get_fixedpath(request.path_info) if git_command not in self.commands: - log.debug('command %s not allowed' % git_command) + log.debug('command %s not allowed', git_command) return exc.HTTPMethodNotAllowed() if 'CONTENT_LENGTH' in environ: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/middleware/simplegit.py --- a/kallithea/lib/middleware/simplegit.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/middleware/simplegit.py Sun Aug 09 02:29:46 2015 +0200 @@ -55,8 +55,8 @@ def is_git(environ): path_info = environ['PATH_INFO'] isgit_path = GIT_PROTO_PAT.match(path_info) - log.debug('pathinfo: %s detected as Git %s' % ( - path_info, isgit_path is not None) + log.debug('pathinfo: %s detected as Git %s', + path_info, isgit_path is not None ) return isgit_path @@ -80,7 +80,7 @@ #====================================================================== try: repo_name = self.__get_repository(environ) - log.debug('Extracted repo name is %s' % repo_name) + log.debug('Extracted repo name is %s', repo_name) except Exception: return HTTPInternalServerError()(environ, start_response) @@ -126,7 +126,7 @@ pre_auth = auth_modules.authenticate('', '', environ) if pre_auth is not None and pre_auth.get('username'): username = pre_auth['username'] - log.debug('PRE-AUTH got %s as username' % username) + log.debug('PRE-AUTH got %s as username', username) # If not authenticated by the container, running basic auth if not username: @@ -178,7 +178,7 @@ #=================================================================== str_repo_name = safe_str(repo_name) repo_path = os.path.join(safe_str(self.basepath),str_repo_name) - log.debug('Repository path is %s' % repo_path) + log.debug('Repository path is %s', repo_path) # CHECK LOCKING only if it's not ANONYMOUS USER if username != User.DEFAULT_USER: @@ -194,19 +194,19 @@ 'locked_by': locked_by}) fix_PATH() - log.debug('HOOKS extras is %s' % extras) + log.debug('HOOKS extras is %s', extras) baseui = make_ui('db') self.__inject_extras(repo_path, baseui, extras) try: self._handle_githooks(repo_name, action, baseui, environ) - log.info('%s action on Git repo "%s" by "%s" from %s' % - (action, str_repo_name, safe_str(username), ip_addr)) + log.info('%s action on Git repo "%s" by "%s" from %s', + action, str_repo_name, safe_str(username), ip_addr) app = self.__make_app(repo_name, repo_path, extras) return app(environ, start_response) except HTTPLockedRC as e: _code = CONFIG.get('lock_ret_code') - log.debug('Repository LOCKED ret code %s!' % (_code)) + log.debug('Repository LOCKED ret code %s!', _code) return e(environ, start_response) except Exception: log.error(traceback.format_exc()) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/middleware/simplehg.py --- a/kallithea/lib/middleware/simplehg.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/middleware/simplehg.py Sun Aug 09 02:29:46 2015 +0200 @@ -60,8 +60,8 @@ else: ishg_path = False - log.debug('pathinfo: %s detected as Mercurial %s' % ( - path_info, ishg_path) + log.debug('pathinfo: %s detected as Mercurial %s', + path_info, ishg_path ) return ishg_path @@ -84,7 +84,7 @@ #====================================================================== try: repo_name = environ['REPO_NAME'] = self.__get_repository(environ) - log.debug('Extracted repo name is %s' % repo_name) + log.debug('Extracted repo name is %s', repo_name) except Exception: return HTTPInternalServerError()(environ, start_response) @@ -130,7 +130,7 @@ pre_auth = auth_modules.authenticate('', '', environ) if pre_auth is not None and pre_auth.get('username'): username = pre_auth['username'] - log.debug('PRE-AUTH got %s as username' % username) + log.debug('PRE-AUTH got %s as username', username) # If not authenticated by the container, running basic auth if not username: @@ -181,7 +181,7 @@ #====================================================================== str_repo_name = safe_str(repo_name) repo_path = os.path.join(safe_str(self.basepath), str_repo_name) - log.debug('Repository path is %s' % repo_path) + log.debug('Repository path is %s', repo_path) # CHECK LOCKING only if it's not ANONYMOUS USER if username != User.DEFAULT_USER: @@ -197,13 +197,13 @@ 'locked_by': locked_by}) fix_PATH() - log.debug('HOOKS extras is %s' % extras) + log.debug('HOOKS extras is %s', extras) baseui = make_ui('db') self.__inject_extras(repo_path, baseui, extras) try: - log.info('%s action on Mercurial repo "%s" by "%s" from %s' % - (action, str_repo_name, safe_str(username), ip_addr)) + log.info('%s action on Mercurial repo "%s" by "%s" from %s', + action, str_repo_name, safe_str(username), ip_addr) app = self.__make_app(repo_path, baseui, extras) return app(environ, start_response) except RepoError as e: @@ -211,7 +211,7 @@ return HTTPNotFound()(environ, start_response) except HTTPLockedRC as e: _code = CONFIG.get('lock_ret_code') - log.debug('Repository LOCKED ret code %s!' % (_code)) + log.debug('Repository LOCKED ret code %s!', _code) return e(environ, start_response) except Exception: log.error(traceback.format_exc()) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/paster_commands/repo_scan.py --- a/kallithea/lib/paster_commands/repo_scan.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/paster_commands/repo_scan.py Sun Aug 09 02:29:46 2015 +0200 @@ -62,7 +62,7 @@ remove_obsolete=rm_obsolete) added = ', '.join(added) or '-' removed = ', '.join(removed) or '-' - log.info('Scan completed added: %s removed: %s' % (added, removed)) + log.info('Scan completed added: %s removed: %s', added, removed) def update_parser(self): self.parser.add_option( diff -r d69aa464f373 -r 0210d0b769d4 kallithea/lib/utils.py --- a/kallithea/lib/utils.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/lib/utils.py Sun Aug 09 02:29:46 2015 +0200 @@ -202,8 +202,8 @@ user_log.user_ip = ipaddr sa.add(user_log) - log.info('Logging action:%s on %s by user:%s ip:%s' % - (action, safe_unicode(repo), user_obj, ipaddr)) + log.info('Logging action:%s on %s by user:%s ip:%s', + action, safe_unicode(repo), user_obj, ipaddr) if commit: sa.commit() @@ -218,14 +218,14 @@ # remove ending slash for better results path = path.rstrip(os.sep) - log.debug('now scanning in %s location recursive:%s...' % (path, recursive)) + log.debug('now scanning in %s location recursive:%s...', path, recursive) def _get_repos(p): if not os.access(p, os.R_OK) or not os.access(p, os.X_OK): - log.warning('ignoring repo path without access: %s' % (p,)) + log.warning('ignoring repo path without access: %s', p) return if not os.access(p, os.W_OK): - log.warning('repo path without write access: %s' % (p,)) + log.warning('repo path without write access: %s', p) for dirpath in os.listdir(p): if os.path.isfile(os.path.join(p, dirpath)): continue @@ -350,14 +350,14 @@ if read_from == 'file': if not os.path.isfile(path): - log.debug('hgrc file is not present at %s, skipping...' % path) + log.debug('hgrc file is not present at %s, skipping...', 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(safe_str(section), safe_str(k), safe_str(v)) elif read_from == 'db': @@ -448,8 +448,8 @@ break if group is None: - log.debug('creating group level: %s group_name: %s' - % (lvl, group_name)) + log.debug('creating group level: %s group_name: %s', + lvl, group_name) group = RepoGroup(group_name, parent) group.group_description = desc group.user = owner @@ -495,7 +495,7 @@ db_repo = repo_model.get_by_repo_name(unicode_name) # found repo that is on filesystem not in Kallithea database if not db_repo: - log.info('repository %s not found, creating now' % name) + log.info('repository %s not found, creating now', name) added.append(name) desc = (repo.description if repo.description != 'unknown' @@ -532,7 +532,7 @@ for repo in sa.query(Repository).all(): if repo.repo_name not in initial_repo_list.keys(): if remove_obsolete: - log.debug("Removing non-existing repository found in db `%s`" % + log.debug("Removing non-existing repository found in db `%s`", repo.repo_name) try: RepoModel(sa).delete(repo, forks='detach', fs_remove=False) @@ -581,7 +581,7 @@ if os.path.isfile(path): rcext = create_module('rc', path) EXT = kallithea.EXTENSIONS = rcext - log.debug('Found rcextensions now loading %s...' % rcext) + log.debug('Found rcextensions now loading %s...', rcext) # Additional mappings that are not present in the pygments lexers conf.LANGUAGES_EXTENSIONS_MAP.update(getattr(EXT, 'EXTRA_MAPPINGS', {})) @@ -657,11 +657,11 @@ # 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): - log.debug('Creating testdir %s' % repos_test_path) + log.debug('Creating testdir %s', repos_test_path) os.makedirs(repos_test_path) dbmanage = DbManage(log_sql=True, dbconf=dbconf, root=config['here'], @@ -682,11 +682,11 @@ #clean index and data if idx_path and os.path.exists(idx_path): - log.debug('remove %s' % idx_path) + log.debug('remove %s', idx_path) shutil.rmtree(idx_path) if data_path and os.path.exists(data_path): - log.debug('remove %s' % data_path) + log.debug('remove %s', data_path) shutil.rmtree(data_path) #CREATE DEFAULT TEST REPOS @@ -810,10 +810,10 @@ req_ver = StrictVersion('1.7.4') - log.debug('Git executable: "%s" version %s detected: %s' - % (settings.GIT_EXECUTABLE_PATH, ver, stdout)) + log.debug('Git executable: "%s" version %s detected: %s', + settings.GIT_EXECUTABLE_PATH, ver, stdout) if stderr: - log.warning('Error detecting git version: %r' % stderr) + log.warning('Error detecting git version: %r', stderr) elif ver < req_ver: log.warning('Kallithea detected git version %s, which is too old ' 'for the system to function properly. ' diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/__init__.py --- a/kallithea/model/__init__.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/__init__.py Sun Aug 09 02:29:46 2015 +0200 @@ -60,7 +60,7 @@ :param engine: engine to bind to """ engine_str = obfuscate_url_pw(str(engine.url)) - log.info("initializing db for %s" % engine_str) + log.info("initializing db for %s", engine_str) meta.Base.metadata.bind = engine diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/db.py --- a/kallithea/model/db.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/db.py Sun Aug 09 02:29:46 2015 +0200 @@ -635,7 +635,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) @classmethod def get_first_admin(cls): @@ -1352,15 +1352,15 @@ if (not self.changeset_cache or cs_cache['raw_id'] != self.changeset_cache['raw_id']): _default = datetime.datetime.fromtimestamp(0) last_change = cs_cache.get('date') or _default - log.debug('updated repo %s with new cs cache %s' - % (self.repo_name, cs_cache)) + log.debug('updated repo %s with new cs cache %s', + self.repo_name, cs_cache) self.updated_on = last_change self.changeset_cache = cs_cache Session().add(self) Session().commit() else: - log.debug('changeset_cache for %s already up to date with %s' - % (self.repo_name, cs_cache['raw_id'])) + log.debug('changeset_cache for %s already up to date with %s', + self.repo_name, cs_cache['raw_id']) @property def tip(self): @@ -1451,18 +1451,18 @@ valid = CacheInvalidation.test_and_set_valid(rn, None, valid_cache_keys=valid_cache_keys) if not valid: - log.debug('Cache for %s invalidated, getting new object' % (rn)) + log.debug('Cache for %s invalidated, getting new object', rn) region_invalidate(_c, None, rn) else: - log.debug('Getting scm_instance of %s from cache' % (rn)) + log.debug('Getting scm_instance of %s from cache', rn) return _c(rn) def __get_instance(self): repo_full_path = self.repo_full_path alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository from %s' - % (alias, repo_full_path)) + log.debug('Creating instance of %s repository from %s', + alias, repo_full_path) backend = get_backend(alias) if alias == 'hg': @@ -2111,12 +2111,12 @@ Mark all caches of a repo as invalid in the database. """ inv_objs = Session().query(cls).filter(cls.cache_args == repo_name).all() - log.debug('for repo %s got %s invalidation objects' - % (safe_str(repo_name), inv_objs)) + log.debug('for repo %s got %s invalidation objects', + safe_str(repo_name), inv_objs) for inv_obj in inv_objs: - log.debug('marking %s key for invalidation based on repo_name=%s' - % (inv_obj, safe_str(repo_name))) + log.debug('marking %s key for invalidation based on repo_name=%s', + inv_obj, safe_str(repo_name)) if delete: Session().delete(inv_obj) else: diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/gist.py --- a/kallithea/model/gist.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/gist.py Sun Aug 09 02:29:46 2015 +0200 @@ -65,7 +65,7 @@ """ root_path = RepoModel().repos_path rm_path = os.path.join(root_path, GIST_STORE_LOC, gist.gist_access_id) - log.info("Removing %s" % (rm_path,)) + log.info("Removing %s", rm_path) shutil.rmtree(rm_path) def _store_metadata(self, repo, gist_id, gist_access_id, user_id, gist_type, @@ -113,9 +113,9 @@ gist_id = safe_unicode(unique_id(20)) lifetime = safe_int(lifetime, -1) gist_expires = time.time() + (lifetime * 60) if lifetime != -1 else -1 - log.debug('set GIST expiration date to: %s' - % (time_to_datetime(gist_expires) - if gist_expires != -1 else 'forever')) + log.debug('set GIST expiration date to: %s', + time_to_datetime(gist_expires) + if gist_expires != -1 else 'forever') #create the Database version gist = Gist() gist.gist_description = description @@ -132,7 +132,7 @@ self.sa.add(gist) gist_repo_path = os.path.join(GIST_STORE_LOC, gist_id) - log.debug('Creating new %s GIST repo in %s' % (gist_type, gist_repo_path)) + log.debug('Creating new %s GIST repo in %s', gist_type, gist_repo_path) repo = RepoModel()._create_filesystem_repo( repo_name=gist_id, repo_type='hg', repo_group=GIST_STORE_LOC) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/notification.py --- a/kallithea/model/notification.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/notification.py Sun Aug 09 02:29:46 2015 +0200 @@ -91,14 +91,14 @@ # TODO: inform user that requested operation couldn't be completed log.error('cannot email unknown user %r', u) recipients_objs = set(recipients_objs) - log.debug('sending notifications %s to %s' % ( - type_, recipients_objs) + log.debug('sending notifications %s to %s', + type_, recipients_objs ) elif recipients is None: # empty recipients means to all admins recipients_objs = User.query().filter(User.admin == True).all() - log.debug('sending notifications %s to admins: %s' % ( - type_, recipients_objs) + log.debug('sending notifications %s to admins: %s', + type_, recipients_objs ) #else: silently skip notification mails? @@ -338,5 +338,5 @@ 'h': h, 'c': c} _kwargs.update(kwargs) - log.debug('rendering tmpl %s with kwargs %s' % (base, _kwargs)) + log.debug('rendering tmpl %s with kwargs %s', base, _kwargs) return email_template.render(**_kwargs) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/permission.py --- a/kallithea/model/permission.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/permission.py Sun Aug 09 02:29:46 2015 +0200 @@ -79,7 +79,7 @@ perms = UserToPerm.query().filter(UserToPerm.user == user).all() defined_perms_groups = map(_get_group, (x.permission.permission_name for x in perms)) - log.debug('GOT ALREADY DEFINED:%s' % perms) + log.debug('GOT ALREADY DEFINED:%s', perms) DEFAULT_PERMS = Permission.DEFAULT_USER_PERMISSIONS if force: @@ -92,8 +92,8 @@ for perm_name in DEFAULT_PERMS: gr = _get_group(perm_name) if gr not in defined_perms_groups: - log.debug('GR:%s not found, creating permission %s' - % (gr, perm_name)) + log.debug('GR:%s not found, creating permission %s', + gr, perm_name) new_perm = _make_perm(perm_name) self.sa.add(new_perm) @@ -108,7 +108,7 @@ # stage 2 reset defaults and set them from form data def _make_new(usr, perm_name): - log.debug('Creating new permission:%s' % (perm_name)) + log.debug('Creating new permission:%s', perm_name) new = UserToPerm() new.user = usr new.permission = Permission.get_by_key(perm_name) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/pull_request.py --- a/kallithea/model/pull_request.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/pull_request.py Sun Aug 09 02:29:46 2015 +0200 @@ -179,7 +179,7 @@ mention_recipients.difference_update(User.get_by_username(username, case_insensitive=True) for username in extract_mentioned_users(old_description)) - log.debug("Mentioning %s" % mention_recipients) + log.debug("Mentioning %s", mention_recipients) self.__add_reviewers(pr, [], mention_recipients) def update_reviewers(self, pull_request, reviewers_ids): @@ -194,10 +194,10 @@ to_add = reviewers_ids.difference(current_reviewers_ids) to_remove = current_reviewers_ids.difference(reviewers_ids) - log.debug("Adding %s reviewers" % to_add) + log.debug("Adding %s reviewers", to_add) self.__add_reviewers(pull_request, to_add) - log.debug("Removing %s reviewers" % to_remove) + log.debug("Removing %s reviewers", to_remove) for uid in to_remove: reviewer = PullRequestReviewers.query()\ .filter(PullRequestReviewers.user_id==uid, diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/repo.py --- a/kallithea/model/repo.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/repo.py Sun Aug 09 02:29:46 2015 +0200 @@ -324,7 +324,7 @@ if 'repo_group' in kwargs: cur_repo.group = RepoGroup.get(kwargs['repo_group']) - log.debug('Updating repo %s with params:%s' % (cur_repo, kwargs)) + log.debug('Updating repo %s with params:%s', cur_repo, kwargs) for k in ['repo_enable_downloads', 'repo_description', 'repo_enable_locking', @@ -584,7 +584,7 @@ obj.user = user obj.permission = permission self.sa.add(obj) - log.debug('Granted perm %s to %s on %s' % (perm, user, repo)) + log.debug('Granted perm %s to %s on %s', perm, user, repo) return obj def revoke_user_permission(self, repo, user): @@ -604,7 +604,7 @@ .scalar() if obj is not None: self.sa.delete(obj) - log.debug('Revoked perm on %s on %s' % (repo, user)) + log.debug('Revoked perm on %s on %s', repo, user) def grant_user_group_permission(self, repo, group_name, perm): """ @@ -634,7 +634,7 @@ obj.users_group = group_name obj.permission = permission self.sa.add(obj) - log.debug('Granted perm %s to %s on %s' % (perm, group_name, repo)) + log.debug('Granted perm %s to %s on %s', perm, group_name, repo) return obj def revoke_user_group_permission(self, repo, group_name): @@ -654,7 +654,7 @@ .scalar() if obj is not None: self.sa.delete(obj) - log.debug('Revoked perm to %s on %s' % (repo, group_name)) + log.debug('Revoked perm to %s on %s', repo, group_name) def delete_stats(self, repo_name): """ @@ -710,9 +710,9 @@ if is_valid_repo_group(repo_path, self.repos_path): raise Exception('This path %s is a valid group' % repo_path) - log.info('creating repo %s in %s from url: `%s`' % ( + log.info('creating repo %s in %s from url: `%s`', repo_name, safe_unicode(repo_path), - obfuscate_url_pw(clone_uri))) + obfuscate_url_pw(clone_uri)) backend = get_backend(repo_type) @@ -731,8 +731,8 @@ else: raise Exception('Not supported repo_type %s expected hg/git' % repo_type) - log.debug('Created repo %s with %s backend' - % (safe_unicode(repo_name), safe_unicode(repo_type))) + log.debug('Created repo %s with %s backend', + safe_unicode(repo_name), safe_unicode(repo_type)) return repo def _rename_filesystem_repo(self, old, new): @@ -742,7 +742,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) @@ -761,7 +761,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) _now = datetime.now() _ms = str(_now.microsecond).rjust(6, '0') diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/repo_group.py --- a/kallithea/model/repo_group.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/repo_group.py Sun Aug 09 02:29:46 2015 +0200 @@ -87,13 +87,13 @@ """ 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 !') os.makedirs(create_path) - log.debug('Created group in %s' % create_path) + log.debug('Created group in %s', create_path) def _rename_group(self, old, new): """ @@ -106,12 +106,12 @@ log.debug('skipping group rename') return - log.debug('renaming repository group from %s to %s' % (old, new)) + log.debug('renaming repository 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 ' @@ -129,7 +129,7 @@ paths = os.sep.join(paths) rm_path = os.path.join(self.repos_path, paths) - log.info("Removing group %s" % (rm_path)) + log.info("Removing group %s", rm_path) # delete only if that path really exists if os.path.isdir(rm_path): if force_delete: @@ -235,8 +235,8 @@ # start updates updates = [] - log.debug('Now updating permissions for %s in recursive mode:%s' - % (repo_group, recursive)) + log.debug('Now updating permissions for %s in recursive mode:%s', + repo_group, recursive) for obj in repo_group.recursive_groups_and_repos(): # iterated obj is an instance of a repos group or repository in @@ -336,7 +336,7 @@ self.sa.delete(repo_group) self._delete_group(repo_group, force_delete) except Exception: - log.error('Error removing repo_group %s' % repo_group) + log.error('Error removing repo_group %s', repo_group) raise def add_permission(self, repo_group, obj, obj_type, perm, recursive): @@ -466,7 +466,7 @@ obj.user = user obj.permission = permission self.sa.add(obj) - log.debug('Granted perm %s to %s on %s' % (perm, user, repo_group)) + log.debug('Granted perm %s to %s on %s', perm, user, repo_group) return obj def revoke_user_permission(self, repo_group, user): @@ -487,7 +487,7 @@ .scalar() if obj is not None: self.sa.delete(obj) - log.debug('Revoked perm on %s on %s' % (repo_group, user)) + log.debug('Revoked perm on %s on %s', repo_group, user) def grant_user_group_permission(self, repo_group, group_name, perm): """ @@ -518,7 +518,7 @@ obj.users_group = group_name obj.permission = permission self.sa.add(obj) - log.debug('Granted perm %s to %s on %s' % (perm, group_name, repo_group)) + log.debug('Granted perm %s to %s on %s', perm, group_name, repo_group) return obj def revoke_user_group_permission(self, repo_group, group_name): @@ -539,4 +539,4 @@ .scalar() if obj is not None: self.sa.delete(obj) - log.debug('Revoked perm to %s on %s' % (repo_group, group_name)) + log.debug('Revoked perm to %s on %s', repo_group, group_name) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/scm.py --- a/kallithea/model/scm.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/scm.py Sun Aug 09 02:29:46 2015 +0200 @@ -272,7 +272,7 @@ if repos_path is None: repos_path = self.repos_path - log.info('scanning for repositories in %s' % repos_path) + log.info('scanning for repositories in %s', repos_path) baseui = make_ui('db') repos = {} @@ -297,7 +297,7 @@ repos[name] = klass(path[1]) except OSError: continue - log.debug('found %s paths with repositories' % (len(repos))) + log.debug('found %s paths with repositories', len(repos)) return repos def get_repos(self, all_repos=None, sort_key=None, simple=False): @@ -854,7 +854,7 @@ for h_type, tmpl in [('pre', tmpl_pre), ('post', tmpl_post)]: _hook_file = jn(loc, '%s-receive' % h_type) has_hook = False - log.debug('Installing git hook in repo %s' % repo) + log.debug('Installing git hook in repo %s', repo) if os.path.exists(_hook_file): # let's take a look at this hook, maybe it's kallithea ? log.debug('hook exists, checking if it is from kallithea') @@ -865,7 +865,7 @@ if matches: try: ver = matches.groups()[0] - log.debug('got %s it is kallithea' % (ver)) + log.debug('got %s it is kallithea', ver) has_hook = True except Exception: log.error(traceback.format_exc()) @@ -874,14 +874,14 @@ has_hook = True if has_hook or force_create: - log.debug('writing %s hook file !' % (h_type,)) + log.debug('writing %s hook file !', h_type) try: with open(_hook_file, 'wb') as f: tmpl = tmpl.replace('_TMPL_', kallithea.__version__) f.write(tmpl) os.chmod(_hook_file, 0755) except IOError as e: - log.error('error writing %s: %s' % (_hook_file, e)) + log.error('error writing %s: %s', _hook_file, e) else: log.debug('skipping writing hook file') diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/user.py --- a/kallithea/model/user.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/user.py Sun Aug 09 02:29:46 2015 +0200 @@ -125,14 +125,14 @@ # raises UserCreationError if it's not allowed check_allowed_create_user(user_data, cur_user) - log.debug('Checking for %s account in Kallithea database' % username) + log.debug('Checking for %s account in Kallithea 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() edit = False else: - log.debug('updating user %s' % username) + log.debug('updating user %s', username) new_user = user edit = True @@ -156,7 +156,7 @@ not check_password(password, new_user.password) if not edit or password_change: reason = 'new password' if edit else 'new user' - log.debug('Updating password reason=>%s' % (reason,)) + log.debug('Updating password reason=>%s', reason) new_user.password = get_crypt_password(password) \ if password else None @@ -279,7 +279,7 @@ user_email = data['email'] user = User.get_by_email(user_email) if user is not None: - log.debug('password reset user found %s' % user) + log.debug('password reset user found %s', user) link = h.canonical_url('reset_password_confirmation', key=user.api_key) reg_type = EmailNotificationModel.TYPE_PASSWORD_RESET @@ -294,9 +294,9 @@ log.debug('sending email') run_task(tasks.send_email, [user_email], _("Password reset link"), body, html_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) + log.debug("password reset email %s not found", user_email) return True @@ -311,14 +311,14 @@ user.password = auth.get_crypt_password(new_passwd) Session().add(user) Session().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') run_task(tasks.send_email, [user_email], _('Your new password'), _('Your new Kallithea password:%s') % (new_passwd,)) - log.info('send new password mail to %s' % user_email) + log.info('send new password mail to %s', user_email) return True diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/user_group.py --- a/kallithea/model/user_group.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/user_group.py Sun Aug 09 02:29:46 2015 +0200 @@ -283,7 +283,7 @@ obj.user = user obj.permission = permission self.sa.add(obj) - log.debug('Granted perm %s to %s on %s' % (perm, user, user_group)) + log.debug('Granted perm %s to %s on %s', perm, user, user_group) return obj def revoke_user_permission(self, user_group, user): @@ -304,7 +304,7 @@ .scalar() if obj is not None: self.sa.delete(obj) - log.debug('Revoked perm on %s on %s' % (user_group, user)) + log.debug('Revoked perm on %s on %s', user_group, user) def grant_user_group_permission(self, target_user_group, user_group, perm): """ @@ -334,7 +334,7 @@ obj.target_user_group = target_user_group obj.permission = permission self.sa.add(obj) - log.debug('Granted perm %s to %s on %s' % (perm, target_user_group, user_group)) + log.debug('Granted perm %s to %s on %s', perm, target_user_group, user_group) return obj def revoke_user_group_permission(self, target_user_group, user_group): @@ -353,11 +353,11 @@ .scalar() if obj is not None: self.sa.delete(obj) - log.debug('Revoked perm on %s on %s' % (target_user_group, user_group)) + log.debug('Revoked perm on %s on %s', target_user_group, user_group) def enforce_groups(self, user, groups, extern_type=None): user = self._get_user(user) - log.debug('Enforcing groups %s on user %s' % (user, groups)) + log.debug('Enforcing groups %s on user %s', user, groups) current_groups = user.group_member # find the external created groups externals = [x.users_group for x in current_groups @@ -367,7 +367,7 @@ # externals that are not in groups for gr in externals: if gr.users_group_name not in groups: - log.debug('Removing user %s from user group %s' % (user, gr)) + log.debug('Removing user %s from user group %s', user, gr) self.remove_user_from_group(gr, user) # now we calculate in which groups user should be == groups params @@ -383,7 +383,7 @@ # we can only add users to special groups created via plugins managed = 'extern_type' in existing_group.group_data if managed: - log.debug('Adding user %s to user group %s' % (user, gr)) + log.debug('Adding user %s to user group %s', user, gr) UserGroupModel().add_user_to_group(existing_group, user) else: log.debug('Skipping addition to group %s since it is ' diff -r d69aa464f373 -r 0210d0b769d4 kallithea/model/validators.py --- a/kallithea/model/validators.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/model/validators.py Sun Aug 09 02:29:46 2015 +0200 @@ -312,13 +312,13 @@ if auth_modules.authenticate(username, password) is None: user = User.get_by_username(username) if user and not user.active: - log.warning('user %s is disabled' % username) + log.warning('user %s is disabled', username) msg = M(self, 'invalid_auth', state) raise formencode.Invalid(msg, value, state, error_dict=dict(username=' ', password=msg) ) else: - log.warning('user %s failed to authenticate' % username) + log.warning('user %s failed to authenticate', username) msg = M(self, 'invalid_auth', state) raise formencode.Invalid(msg, value, state, error_dict=dict(username=' ', password=msg) diff -r d69aa464f373 -r 0210d0b769d4 kallithea/tests/scripts/manual_test_concurrency.py --- a/kallithea/tests/scripts/manual_test_concurrency.py Sun Aug 09 02:17:14 2015 +0200 +++ b/kallithea/tests/scripts/manual_test_concurrency.py Sun Aug 09 02:29:46 2015 +0200 @@ -72,7 +72,7 @@ """ command = cmd + ' ' + ' '.join(args) - log.debug('Executing %s' % command) + log.debug('Executing %s', command) if DEBUG: print command p = Popen(command, shell=True, stdout=PIPE, stderr=PIPE, cwd=self.cwd)