diff options
Diffstat (limited to 'rhodecode/lib')
-rw-r--r-- | rhodecode/lib/auth.py | 36 | ||||
-rw-r--r-- | rhodecode/lib/auth_ldap.py | 9 | ||||
-rw-r--r-- | rhodecode/lib/celerylib/__init__.py | 6 | ||||
-rw-r--r-- | rhodecode/lib/celerylib/tasks.py | 16 | ||||
-rw-r--r-- | rhodecode/lib/db_manage.py | 10 | ||||
-rw-r--r-- | rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py | 2 | ||||
-rwxr-xr-x | rhodecode/lib/dbmigrate/schema/db_1_2_0.py | 4 | ||||
-rw-r--r-- | rhodecode/lib/dbmigrate/versions/001_initial_release.py | 2 | ||||
-rw-r--r-- | rhodecode/lib/utils.py | 10 |
9 files changed, 49 insertions, 46 deletions
diff --git a/rhodecode/lib/auth.py b/rhodecode/lib/auth.py index 07f8fcc9..21b457b2 100644 --- a/rhodecode/lib/auth.py +++ b/rhodecode/lib/auth.py @@ -177,10 +177,10 @@ def authenticate(username, password): elif user.username == username and check_password(password, user.password): - log.info('user %s authenticated correctly', username) + log.info('user %s authenticated correctly' % username) return True else: - log.warning('user %s is disabled', username) + log.warning('user %s is disabled' % username) else: log.debug('Regular authentication failed') @@ -214,7 +214,7 @@ def authenticate(username, password): aldap = AuthLdap(**kwargs) (user_dn, ldap_attrs) = aldap.authenticate_ldap(username, password) - log.debug('Got ldap DN response %s', user_dn) + log.debug('Got ldap DN response %s' % user_dn) get_ldap_attr = lambda k: ldap_attrs.get(ldap_settings\ .get(k), [''])[0] @@ -227,7 +227,7 @@ def authenticate(username, password): if user_model.create_ldap(username, password, user_dn, user_attrs): - log.info('created new ldap user %s', username) + log.info('created new ldap user %s' % username) Session.commit() return True @@ -250,7 +250,7 @@ def login_container_auth(username): user = UserModel().create_for_container_auth(username, user_attrs) if not user: return None - log.info('User %s was created by container authentication', username) + log.info('User %s was created by container authentication' % username) if not user.active: return None @@ -277,7 +277,7 @@ def get_container_username(environ, config): # Removing realm and domain from username username = username.partition('@')[0] username = username.rpartition('\\')[2] - log.debug('Received username %s from container', username) + log.debug('Received username %s from container' % username) return username @@ -315,18 +315,18 @@ class AuthUser(object): # try go get user by api key if self._api_key and self._api_key != self.anonymous_user.api_key: - log.debug('Auth User lookup by API KEY %s', self._api_key) + log.debug('Auth User lookup by API KEY %s' % self._api_key) is_user_loaded = user_model.fill_data(self, api_key=self._api_key) # lookup by userid elif (self.user_id is not None and self.user_id != self.anonymous_user.user_id): - log.debug('Auth User lookup by USER ID %s', self.user_id) + log.debug('Auth User lookup by USER ID %s' % self.user_id) is_user_loaded = user_model.fill_data(self, user_id=self.user_id) # lookup by username elif self.username and \ str2bool(config.get('container_auth_enabled', False)): - log.debug('Auth User lookup by USER NAME %s', self.username) + log.debug('Auth User lookup by USER NAME %s' % self.username) dbuser = login_container_auth(self.username) if dbuser is not None: for k, v in dbuser.get_dict().items(): @@ -348,7 +348,7 @@ class AuthUser(object): if not self.username: self.username = 'None' - log.debug('Auth User is now %s', self) + log.debug('Auth User is now %s' % self) user_model.fill_perms(self) @property @@ -422,21 +422,21 @@ class LoginRequired(object): api_access_ok = False if self.api_access: - log.debug('Checking API KEY access for %s', cls) + log.debug('Checking API KEY access for %s' % cls) if user.api_key == request.GET.get('api_key'): api_access_ok = True else: log.debug("API KEY token not valid") - log.debug('Checking if %s is authenticated @ %s', user.username, cls) + log.debug('Checking if %s is authenticated @ %s' % (user.username, cls)) if user.is_authenticated or api_access_ok: - log.debug('user %s is authenticated', user.username) + log.debug('user %s is authenticated' % user.username) return func(*fargs, **fkwargs) else: - log.warn('user %s NOT authenticated', user.username) + log.warn('user %s NOT authenticated' % user.username) p = url.current() - log.debug('redirecting to login page with %s', p) + log.debug('redirecting to login page with %s' % p) return redirect(url('login_home', came_from=p)) @@ -452,7 +452,7 @@ class NotAnonymous(object): cls = fargs[0] self.user = cls.rhodecode_user - log.debug('Checking if user is not anonymous @%s', cls) + log.debug('Checking if user is not anonymous @%s' % cls) anonymous = self.user.username == 'default' @@ -491,11 +491,11 @@ class PermsDecorator(object): self.user) if self.check_permissions(): - log.debug('Permission granted for %s %s', cls, self.user) + log.debug('Permission granted for %s %s' % (cls, self.user)) return func(*fargs, **fkwargs) else: - log.warning('Permission denied for %s %s', cls, self.user) + log.warning('Permission denied for %s %s' % (cls, self.user)) anonymous = self.user.username == 'default' if anonymous: diff --git a/rhodecode/lib/auth_ldap.py b/rhodecode/lib/auth_ldap.py index 3f7773d3..6ad8c3da 100644 --- a/rhodecode/lib/auth_ldap.py +++ b/rhodecode/lib/auth_ldap.py @@ -138,8 +138,11 @@ class AuthLdap(object): break except ldap.INVALID_CREDENTIALS: - log.debug("LDAP rejected password for user '%s' (%s): %s", - uid, username, dn) + log.debug( + "LDAP rejected password for user '%s' (%s): %s" % ( + uid, username, dn + ) + ) else: log.debug("No matching LDAP objects for authentication " @@ -147,7 +150,7 @@ class AuthLdap(object): raise LdapPasswordError() except ldap.NO_SUCH_OBJECT: - log.debug("LDAP says no such user '%s' (%s)", uid, username) + log.debug("LDAP says no such user '%s' (%s)" % (uid, username)) raise LdapUsernameError() except ldap.SERVER_DOWN: raise LdapConnectionError("LDAP can't access " diff --git a/rhodecode/lib/celerylib/__init__.py b/rhodecode/lib/celerylib/__init__.py index 215e5bd7..b9346fe1 100644 --- a/rhodecode/lib/celerylib/__init__.py +++ b/rhodecode/lib/celerylib/__init__.py @@ -62,7 +62,7 @@ def run_task(task, *args, **kwargs): if CELERY_ON: try: t = task.apply_async(args=args, kwargs=kwargs) - log.info('running task %s:%s', t.task_id, task) + log.info('running task %s:%s' % (t.task_id, task)) return t except socket.error, e: @@ -75,7 +75,7 @@ def run_task(task, *args, **kwargs): except Exception, e: log.error(traceback.format_exc()) - log.debug('executing task %s in sync mode', task) + log.debug('executing task %s in sync mode' % task) return ResultWrapper(task(*args, **kwargs)) @@ -95,7 +95,7 @@ def locked_task(func): lockkey = __get_lockkey(func, *fargs, **fkwargs) lockkey_path = config['here'] - log.info('running task with lockkey %s', lockkey) + log.info('running task with lockkey %s' % lockkey) try: l = DaemonLock(file_=jn(lockkey_path, lockkey)) ret = func(*fargs, **fkwargs) diff --git a/rhodecode/lib/celerylib/tasks.py b/rhodecode/lib/celerylib/tasks.py index 80fe1755..0ccc7379 100644 --- a/rhodecode/lib/celerylib/tasks.py +++ b/rhodecode/lib/celerylib/tasks.py @@ -92,12 +92,12 @@ def get_commits_stats(repo_name, ts_min_y, ts_max_y): ts_max_y) lockkey_path = config['here'] - log.info('running task with lockkey %s', lockkey) + log.info('running task with lockkey %s' % lockkey) try: lock = l = DaemonLock(file_=jn(lockkey_path, lockkey)) - # for js data compatibilty cleans the key for person from ' + # for js data compatibility cleans the key for person from ' akc = lambda k: person(k).replace('"', "") co_day_auth_aggr = {} @@ -139,7 +139,7 @@ def get_commits_stats(repo_name, ts_min_y, ts_max_y): cur_stats.commit_activity_combined)) co_day_auth_aggr = json.loads(cur_stats.commit_activity) - log.debug('starting parsing %s', parse_limit) + log.debug('starting parsing %s' % parse_limit) lmktime = mktime last_rev = last_rev + 1 if last_rev >= 0 else 0 @@ -214,9 +214,9 @@ def get_commits_stats(repo_name, ts_min_y, ts_max_y): stats.commit_activity = json.dumps(co_day_auth_aggr) stats.commit_activity_combined = json.dumps(overview_data) - log.debug('last revison %s', last_rev) + log.debug('last revison %s' % last_rev) leftovers = len(repo.revisions[last_rev:]) - log.debug('revisions to parse %s', leftovers) + log.debug('revisions to parse %s' % leftovers) if last_rev == 0 or leftovers < parse_limit: log.debug('getting code trending stats') @@ -265,7 +265,7 @@ def send_password_link(user_email): log.debug('sending email') run_task(send_email, user_email, _("password reset link"), body) - log.info('send new password mail to %s', user_email) + log.info('send new password mail to %s' % user_email) else: log.debug("password reset email %s not found" % user_email) except: @@ -292,7 +292,7 @@ def reset_user_password(user_email): user.api_key = auth.generate_api_key(user.username) DBS.add(user) DBS.commit() - log.info('change password for %s', user_email) + log.info('change password for %s' % user_email) if new_passwd is None: raise Exception('unable to generate new password') except: @@ -302,7 +302,7 @@ def reset_user_password(user_email): run_task(send_email, user_email, 'Your new password', 'Your new RhodeCode password:%s' % (new_passwd)) - log.info('send new password mail to %s', user_email) + log.info('send new password mail to %s' % user_email) except: log.error('Failed to update user password') diff --git a/rhodecode/lib/db_manage.py b/rhodecode/lib/db_manage.py index 507566a2..4dbd390b 100644 --- a/rhodecode/lib/db_manage.py +++ b/rhodecode/lib/db_manage.py @@ -76,7 +76,7 @@ class DbManage(object): checkfirst = not override meta.Base.metadata.create_all(checkfirst=checkfirst) - log.info('Created tables for %s', self.dbname) + log.info('Created tables for %s' % self.dbname) def set_db_version(self): ver = DbMigrateVersion() @@ -84,7 +84,7 @@ class DbManage(object): ver.repository_id = 'rhodecode_db_migrations' ver.repository_path = 'versions' self.sa.add(ver) - log.info('db version set to: %s', __dbversion__) + log.info('db version set to: %s' % __dbversion__) def upgrade(self): """ @@ -364,12 +364,12 @@ class DbManage(object): # check proper dir if not os.path.isdir(path): path_ok = False - log.error('Given path %s is not a valid directory', path) + log.error('Given path %s is not a valid directory' % path) # check write access if not os.access(path, os.W_OK) and path_ok: path_ok = False - log.error('No write permission to given path %s', path) + log.error('No write permission to given path %s' % path) if retries == 0: sys.exit('max retries reached') @@ -427,7 +427,7 @@ class DbManage(object): log.info('created ui config') def create_user(self, username, password, email='', admin=False): - log.info('creating user %s', username) + log.info('creating user %s' % username) UserModel().create_or_update(username, password, email, name='RhodeCode', lastname='Admin', active=True, admin=admin) diff --git a/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py b/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py index a9edc35c..24ba7ceb 100644 --- a/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py +++ b/rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py @@ -159,7 +159,7 @@ def with_engine(f, *a, **kw): return f(*a, **kw) finally: if isinstance(engine, Engine): - log.debug('Disposing SQLAlchemy engine %s', engine) + log.debug('Disposing SQLAlchemy engine %s' % engine) engine.dispose() diff --git a/rhodecode/lib/dbmigrate/schema/db_1_2_0.py b/rhodecode/lib/dbmigrate/schema/db_1_2_0.py index 0a16f7b3..0acbd2ce 100755 --- a/rhodecode/lib/dbmigrate/schema/db_1_2_0.py +++ b/rhodecode/lib/dbmigrate/schema/db_1_2_0.py @@ -320,7 +320,7 @@ class User(Base, BaseModel): self.last_login = datetime.datetime.now() Session.add(self) Session.commit() - log.debug('updated user %s lastlogin', self.username) + log.debug('updated user %s lastlogin' % self.username) @classmethod def create(cls, form_data): @@ -695,7 +695,7 @@ class Repository(Base, BaseModel): try: alias = get_scm(repo_full_path)[0] - log.debug('Creating instance of %s repository', alias) + log.debug('Creating instance of %s repository' % alias) backend = get_backend(alias) except VCSError: log.error(traceback.format_exc()) diff --git a/rhodecode/lib/dbmigrate/versions/001_initial_release.py b/rhodecode/lib/dbmigrate/versions/001_initial_release.py index a7c4e901..bdc64cd0 100644 --- a/rhodecode/lib/dbmigrate/versions/001_initial_release.py +++ b/rhodecode/lib/dbmigrate/versions/001_initial_release.py @@ -74,7 +74,7 @@ class User(Base): 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 --git a/rhodecode/lib/utils.py b/rhodecode/lib/utils.py index 35f8bb2d..aeb3b49b 100644 --- a/rhodecode/lib/utils.py +++ b/rhodecode/lib/utils.py @@ -140,7 +140,7 @@ def action_logger(user, action, repo, ipaddr='', sa=None, commit=False): user_log.user_ip = ipaddr sa.add(user_log) - log.info('Adding user %s, action %s on %s', user_obj, action, repo) + log.info('Adding user %s, action %s on %s' % (user_obj, action, repo)) if commit: sa.commit() except: @@ -261,12 +261,12 @@ def make_ui(read_from='file', path=None, checkpaths=True): if not os.path.isfile(path): log.warning('Unable to read config file %s' % path) return False - log.debug('reading hgrc from %s', path) + log.debug('reading hgrc from %s' % path) cfg = config.config() cfg.read(path) for section in ui_sections: for k, v in cfg.items(section): - log.debug('settings ui from file[%s]%s:%s', section, k, v) + log.debug('settings ui from file[%s]%s:%s' % (section, k, v)) baseui.setconfig(section, k, v) elif read_from == 'db': @@ -401,7 +401,7 @@ def repo2db_mapper(initial_repo_list, remove_obsolete=False): for name, repo in initial_repo_list.items(): group = map_groups(name.split(Repository.url_sep())) if not rm.get_by_repo_name(name, cache=False): - log.info('repository %s not found creating default', name) + log.info('repository %s not found creating default' % name) added.append(name) form_data = { 'repo_name': name, @@ -494,7 +494,7 @@ def create_test_env(repos_test_path, config): # 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): |