Changeset - a76e9bacbedc
rhodecode/controllers/admin/settings.py
Show inline comments
 
@@ -101,7 +101,7 @@ class SettingsController(BaseController)
 
        # url('admin_setting', setting_id=ID)
 
        if setting_id == 'mapping':
 
            rm_obsolete = request.POST.get('destroy', False)
 
            log.debug('Rescanning directories with destroy=%s', rm_obsolete)
 
            log.debug('Rescanning directories with destroy=%s' % rm_obsolete)
 
            initial = ScmModel().repo_scan()
 
            log.debug('invalidating all repositories')
 
            for repo_name in initial.keys():
rhodecode/controllers/api/__init__.py
Show inline comments
 
@@ -100,7 +100,7 @@ class JSONRPCController(WSGIController):
 
        else:
 
            length = environ['CONTENT_LENGTH'] or 0
 
            length = int(environ['CONTENT_LENGTH'])
 
            log.debug('Content-Length: %s', length)
 
            log.debug('Content-Length: %s' % length)
 

	
 
        if length == 0:
 
            log.debug("Content-Length is 0")
 
@@ -121,9 +121,10 @@ class JSONRPCController(WSGIController):
 
            self._req_id = json_body['id']
 
            self._req_method = json_body['method']
 
            self._request_params = json_body['args']
 
            log.debug('method: %s, params: %s',
 
                      self._req_method,
 
            log.debug(
 
                'method: %s, params: %s' % (self._req_method,
 
                      self._request_params)
 
            )
 
        except KeyError, e:
 
            return jsonrpc_error(message='Incorrect JSON query missing %s' % e)
 

	
 
@@ -232,7 +233,7 @@ class JSONRPCController(WSGIController):
 
        try:
 
            return json.dumps(response)
 
        except TypeError, e:
 
            log.debug('Error encoding response: %s', e)
 
            log.debug('Error encoding response: %s' % e)
 
            return json.dumps(
 
                dict(
 
                    self._req_id,
 
@@ -245,7 +246,7 @@ class JSONRPCController(WSGIController):
 
        """
 
        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")
 

	
rhodecode/controllers/error.py
Show inline comments
 
@@ -54,7 +54,7 @@ class ErrorController(BaseController):
 
        resp = request.environ.get('pylons.original_response')
 
        c.rhodecode_name = config.get('rhodecode_title')
 

	
 
        log.debug('### %s ###', resp.status)
 
        log.debug('### %s ###' % resp.status)
 

	
 
        e = request.environ
 
        c.serv_p = r'%(protocol)s://%(host)s/' \
rhodecode/controllers/journal.py
Show inline comments
 
@@ -149,7 +149,7 @@ class JournalController(BaseController):
 
                except:
 
                    raise HTTPBadRequest()
 

	
 
        log.debug('token mismatch %s vs %s', cur_token, token)
 
        log.debug('token mismatch %s vs %s' % (cur_token, token))
 
        raise HTTPBadRequest()
 

	
 
    @LoginRequired()
rhodecode/lib/auth.py
Show inline comments
 
@@ -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, conf
 
        # 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:
rhodecode/lib/auth_ldap.py
Show inline comments
 
@@ -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 "
rhodecode/lib/celerylib/__init__.py
Show inline comments
 
@@ -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)
rhodecode/lib/celerylib/tasks.py
Show inline comments
 
@@ -92,12 +92,12 @@ def get_commits_stats(repo_name, ts_min_
 
                            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_
 
                                        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_
 
        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')
rhodecode/lib/db_manage.py
Show inline comments
 
@@ -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)
rhodecode/lib/dbmigrate/migrate/versioning/util/__init__.py
Show inline comments
 
@@ -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()
 

	
 

	
rhodecode/lib/dbmigrate/schema/db_1_2_0.py
Show inline comments
 
@@ -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())
rhodecode/lib/dbmigrate/versions/001_initial_release.py
Show inline comments
 
@@ -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()
 

	
rhodecode/lib/utils.py
Show inline comments
 
@@ -140,7 +140,7 @@ def action_logger(user, action, repo, ip
 
        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,
 
        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, re
 
    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, con
 

	
 
    # 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):
rhodecode/model/__init__.py
Show inline comments
 
@@ -56,7 +56,7 @@ def init_model(engine):
 

	
 
    :param engine: engine to bind to
 
    """
 
    log.info("initializing db for %s", engine)
 
    log.info("initializing db for %s" % engine)
 
    meta.Base.metadata.bind = engine
 

	
 

	
rhodecode/model/db.py
Show inline comments
 
@@ -366,7 +366,7 @@ class User(Base, BaseModel):
 
        """Update user lastlogin"""
 
        self.last_login = datetime.datetime.now()
 
        Session.add(self)
 
        log.debug('updated user %s lastlogin', self.username)
 
        log.debug('updated user %s lastlogin' % self.username)
 

	
 
    def __json__(self):
 
        return dict(
 
@@ -682,7 +682,7 @@ class Repository(Base, BaseModel):
 
        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())
rhodecode/model/forms.py
Show inline comments
 
@@ -248,7 +248,7 @@ class ValidAuth(formencode.validators.Fa
 
            return value
 
        else:
 
            if user and user.active is False:
 
                log.warning('user %s is disabled', username)
 
                log.warning('user %s is disabled' % username)
 
                raise formencode.Invalid(
 
                    self.message('disabled_account',
 
                    state=State_obj),
 
@@ -256,7 +256,7 @@ class ValidAuth(formencode.validators.Fa
 
                    error_dict=self.e_dict_disable
 
                )
 
            else:
 
                log.warning('user %s not authenticated', username)
 
                log.warning('user %s not authenticated' % username)
 
                raise formencode.Invalid(
 
                    self.message('invalid_password',
 
                    state=State_obj), value, state,
rhodecode/model/repo.py
Show inline comments
 
@@ -401,7 +401,7 @@ class RepoModel(BaseModel):
 
        :param old: old name
 
        :param new: new name
 
        """
 
        log.info('renaming repo from %s to %s', old, new)
 
        log.info('renaming repo from %s to %s' % (old, new))
 

	
 
        old_path = os.path.join(self.repos_path, old)
 
        new_path = os.path.join(self.repos_path, new)
 
@@ -420,7 +420,7 @@ class RepoModel(BaseModel):
 
        :param repo: repo object
 
        """
 
        rm_path = os.path.join(self.repos_path, repo.repo_name)
 
        log.info("Removing %s", rm_path)
 
        log.info("Removing %s" % (rm_path))
 
        # disable hg/git
 
        alias = repo.repo_type
 
        shutil.move(os.path.join(rm_path, '.%s' % alias),
rhodecode/model/repos_group.py
Show inline comments
 
@@ -58,7 +58,7 @@ class ReposGroupModel(BaseModel):
 
        """
 

	
 
        create_path = os.path.join(self.repos_path, group_name)
 
        log.debug('creating new group in %s', create_path)
 
        log.debug('creating new group in %s' % create_path)
 

	
 
        if os.path.isdir(create_path):
 
            raise Exception('That directory already exists !')
 
@@ -76,13 +76,12 @@ class ReposGroupModel(BaseModel):
 
            log.debug('skipping group rename')
 
            return
 

	
 
        log.debug('renaming repos group from %s to %s', old, new)
 

	
 
        log.debug('renaming repos group from %s to %s' % (old, new))
 

	
 
        old_path = os.path.join(self.repos_path, old)
 
        new_path = os.path.join(self.repos_path, new)
 

	
 
        log.debug('renaming repos paths from %s to %s', old_path, new_path)
 
        log.debug('renaming repos paths from %s to %s' % (old_path, new_path))
 

	
 
        if os.path.isdir(new_path):
 
            raise Exception('Was trying to rename to already '
rhodecode/model/user.py
Show inline comments
 
@@ -110,13 +110,13 @@ class UserModel(BaseModel):
 

	
 
        from rhodecode.lib.auth import get_crypt_password
 

	
 
        log.debug('Checking for %s account in RhodeCode database', username)
 
        log.debug('Checking for %s account in RhodeCode database' % username)
 
        user = User.get_by_username(username, case_insensitive=True)
 
        if user is None:
 
            log.debug('creating new user %s', username)
 
            log.debug('creating new user %s' % username)
 
            new_user = User()
 
        else:
 
            log.debug('updating user %s', username)
 
            log.debug('updating user %s' % username)
 
            new_user = user
 

	
 
        try:
 
@@ -327,7 +327,7 @@ class UserModel(BaseModel):
 
                dbuser = self.get(user_id)
 

	
 
            if dbuser is not None and dbuser.active:
 
                log.debug('filling %s data', dbuser)
 
                log.debug('filling %s data' % dbuser)
 
                for k, v in dbuser.get_dict().items():
 
                    setattr(auth_user, k, v)
 
            else:
0 comments (0 inline, 0 general)