Changeset - f373f182b756
[Not reviewed]
kallithea/controllers/admin/settings.py
Show inline comments
 
@@ -243,29 +243,29 @@ class SettingsController(BaseController)
 
                    errors=errors.error_dict or {},
 
                    prefix_error=False,
 
                    encoding="UTF-8")
 

	
 
            try:
 
                sett1 = Setting.create_or_update('title',
 
                                            form_result['rhodecode_title'])
 
                                            form_result['title'])
 
                Session().add(sett1)
 

	
 
                sett2 = Setting.create_or_update('realm',
 
                                            form_result['rhodecode_realm'])
 
                                            form_result['realm'])
 
                Session().add(sett2)
 

	
 
                sett3 = Setting.create_or_update('ga_code',
 
                                            form_result['rhodecode_ga_code'])
 
                                            form_result['ga_code'])
 
                Session().add(sett3)
 

	
 
                sett4 = Setting.create_or_update('captcha_public_key',
 
                                    form_result['rhodecode_captcha_public_key'])
 
                                    form_result['captcha_public_key'])
 
                Session().add(sett4)
 

	
 
                sett5 = Setting.create_or_update('captcha_private_key',
 
                                    form_result['rhodecode_captcha_private_key'])
 
                                    form_result['captcha_private_key'])
 
                Session().add(sett5)
 

	
 
                Session().commit()
 
                set_app_settings(config)
 
                h.flash(_('Updated application settings'), category='success')
 

	
 
@@ -303,22 +303,22 @@ class SettingsController(BaseController)
 
                    prefix_error=False,
 
                    encoding="UTF-8"
 
                )
 

	
 
            try:
 
                settings = [
 
                    ('show_public_icon', 'rhodecode_show_public_icon', 'bool'),
 
                    ('show_private_icon', 'rhodecode_show_private_icon', 'bool'),
 
                    ('stylify_metatags', 'rhodecode_stylify_metatags', 'bool'),
 
                    ('repository_fields', 'rhodecode_repository_fields', 'bool'),
 
                    ('dashboard_items', 'rhodecode_dashboard_items', 'int'),
 
                    ('admin_grid_items', 'rhodecode_admin_grid_items', 'int'),
 
                    ('show_version', 'rhodecode_show_version', 'bool'),
 
                    ('use_gravatar', 'rhodecode_use_gravatar', 'bool'),
 
                    ('gravatar_url', 'rhodecode_gravatar_url', 'unicode'),
 
                    ('clone_uri_tmpl', 'rhodecode_clone_uri_tmpl', 'unicode'),
 
                    ('show_public_icon', 'show_public_icon', 'bool'),
 
                    ('show_private_icon', 'show_private_icon', 'bool'),
 
                    ('stylify_metatags', 'stylify_metatags', 'bool'),
 
                    ('repository_fields', 'repository_fields', 'bool'),
 
                    ('dashboard_items', 'dashboard_items', 'int'),
 
                    ('admin_grid_items', 'admin_grid_items', 'int'),
 
                    ('show_version', 'show_version', 'bool'),
 
                    ('use_gravatar', 'use_gravatar', 'bool'),
 
                    ('gravatar_url', 'gravatar_url', 'unicode'),
 
                    ('clone_uri_tmpl', 'clone_uri_tmpl', 'unicode'),
 
                ]
 
                for setting, form_key, type_ in settings:
 
                    sett = Setting.create_or_update(setting,
 
                                        form_result[form_key], type_)
 
                    Session().add(sett)
 

	
 
@@ -461,13 +461,13 @@ class SettingsController(BaseController)
 

	
 
        defaults = Setting.get_app_settings()
 
        defaults.update(self._get_hg_ui_settings())
 

	
 
        import kallithea
 
        c.ini = kallithea.CONFIG
 
        c.rhodecode_update_url = defaults.get('rhodecode_update_url')
 
        c.update_url = defaults.get('update_url')
 
        server_info = Setting.get_server_info()
 
        for key, val in server_info.iteritems():
 
            setattr(c, key, val)
 

	
 
        return htmlfill.render(
 
            render('admin/settings/settings.html'),
 
@@ -483,13 +483,13 @@ class SettingsController(BaseController)
 
        import urllib2
 
        from kallithea.lib.verlib import NormalizedVersion
 
        from kallithea import __version__
 

	
 
        defaults = Setting.get_app_settings()
 
        defaults.update(self._get_hg_ui_settings())
 
        _update_url = defaults.get('rhodecode_update_url', '')
 
        _update_url = defaults.get('update_url', '')
 
        _update_url = "" # FIXME: disabled
 

	
 
        _err = lambda s: '<div style="color:#ff8888; padding:4px 0px">%s</div>' % (s)
 
        try:
 
            import kallithea
 
            ver = kallithea.__version__
kallithea/controllers/error.py
Show inline comments
 
@@ -52,13 +52,13 @@ class ErrorController(BaseController):
 
    def __before__(self):
 
        #disable all base actions since we don't need them here
 
        pass
 

	
 
    def document(self):
 
        resp = request.environ.get('pylons.original_response')
 
        c.site_name = config.get('rhodecode_title')
 
        c.site_name = config.get('title')
 

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

	
 
        e = request.environ
 
        c.serv_p = r'%(protocol)s://%(host)s/' \
 
                                    % {'protocol': e.get('wsgi.url_scheme'),
kallithea/controllers/login.py
Show inline comments
 
@@ -163,15 +163,15 @@ class LoginController(BaseController):
 
                               'hg.register.manual_activate')
 
    def register(self):
 
        c.auto_active = 'hg.register.auto_activate' in User.get_default_user()\
 
            .AuthUser.permissions['global']
 

	
 
        settings = Setting.get_app_settings()
 
        captcha_private_key = settings.get('rhodecode_captcha_private_key')
 
        captcha_private_key = settings.get('captcha_private_key')
 
        c.captcha_active = bool(captcha_private_key)
 
        c.captcha_public_key = settings.get('rhodecode_captcha_public_key')
 
        c.captcha_public_key = settings.get('captcha_public_key')
 

	
 
        if request.POST:
 
            register_form = RegisterForm()()
 
            try:
 
                form_result = register_form.to_python(dict(request.POST))
 
                form_result['active'] = c.auto_active
 
@@ -210,15 +210,15 @@ class LoginController(BaseController):
 
                h.flash(e, 'error')
 

	
 
        return render('/register.html')
 

	
 
    def password_reset(self):
 
        settings = Setting.get_app_settings()
 
        captcha_private_key = settings.get('rhodecode_captcha_private_key')
 
        captcha_private_key = settings.get('captcha_private_key')
 
        c.captcha_active = bool(captcha_private_key)
 
        c.captcha_public_key = settings.get('rhodecode_captcha_public_key')
 
        c.captcha_public_key = settings.get('captcha_public_key')
 

	
 
        if request.POST:
 
            password_reset_form = PasswordResetForm()()
 
            try:
 
                form_result = password_reset_form.to_python(dict(request.POST))
 
                if c.captcha_active:
kallithea/lib/base.py
Show inline comments
 
@@ -288,25 +288,25 @@ class BaseController(WSGIController):
 
        rc_config = Setting.get_app_settings()
 

	
 
        # Visual options
 
        c.visual = AttributeDict({})
 

	
 
        ## DB stored
 
        c.visual.show_public_icon = str2bool(rc_config.get('rhodecode_show_public_icon'))
 
        c.visual.show_private_icon = str2bool(rc_config.get('rhodecode_show_private_icon'))
 
        c.visual.stylify_metatags = str2bool(rc_config.get('rhodecode_stylify_metatags'))
 
        c.visual.dashboard_items = safe_int(rc_config.get('rhodecode_dashboard_items', 100))
 
        c.visual.admin_grid_items = safe_int(rc_config.get('rhodecode_admin_grid_items', 100))
 
        c.visual.repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        c.visual.show_version = str2bool(rc_config.get('rhodecode_show_version'))
 
        c.visual.use_gravatar = str2bool(rc_config.get('rhodecode_use_gravatar'))
 
        c.visual.gravatar_url = rc_config.get('rhodecode_gravatar_url')
 
        c.visual.show_public_icon = str2bool(rc_config.get('show_public_icon'))
 
        c.visual.show_private_icon = str2bool(rc_config.get('show_private_icon'))
 
        c.visual.stylify_metatags = str2bool(rc_config.get('stylify_metatags'))
 
        c.visual.dashboard_items = safe_int(rc_config.get('dashboard_items', 100))
 
        c.visual.admin_grid_items = safe_int(rc_config.get('admin_grid_items', 100))
 
        c.visual.repository_fields = str2bool(rc_config.get('repository_fields'))
 
        c.visual.show_version = str2bool(rc_config.get('show_version'))
 
        c.visual.use_gravatar = str2bool(rc_config.get('use_gravatar'))
 
        c.visual.gravatar_url = rc_config.get('gravatar_url')
 

	
 
        c.ga_code = rc_config.get('rhodecode_ga_code')
 
        c.site_name = rc_config.get('rhodecode_title')
 
        c.clone_uri_tmpl = rc_config.get('rhodecode_clone_uri_tmpl')
 
        c.ga_code = rc_config.get('ga_code')
 
        c.site_name = rc_config.get('title')
 
        c.clone_uri_tmpl = rc_config.get('clone_uri_tmpl')
 

	
 
        ## INI stored
 
        c.visual.allow_repo_location_change = str2bool(config.get('allow_repo_location_change', True))
 
        c.visual.allow_custom_hooks_settings = str2bool(config.get('allow_custom_hooks_settings', True))
 

	
 
        c.instance_id = config.get('instance_id')
kallithea/lib/dbmigrate/schema/db_1_2_0.py
Show inline comments
 
@@ -193,13 +193,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_ldap_settings(cls, cache=False):
kallithea/lib/dbmigrate/schema/db_1_3_0.py
Show inline comments
 
@@ -212,13 +212,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_ldap_settings(cls, cache=False):
kallithea/lib/dbmigrate/schema/db_1_4_0.py
Show inline comments
 
@@ -210,13 +210,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_ldap_settings(cls, cache=False):
 
@@ -791,13 +791,13 @@ class Repository(Base, BaseModel):
 
        required = (MercurialRepository, GitRepository)
 
        if not isinstance(repo, required):
 
            raise Exception('repo must be instance of %s' % (','.join(required)))
 

	
 
        # inject ui extra param to log this action via push logger
 
        for k, v in extras.items():
 
            repo._repo.ui.setconfig('rhodecode_extras', k, v)
 
            repo._repo.ui.setconfig('extras', k, v)
 

	
 
    @classmethod
 
    def is_valid(cls, repo_name):
 
        """
 
        returns True if given repo name is a valid filesystem repository
 

	
kallithea/lib/dbmigrate/schema/db_1_5_0.py
Show inline comments
 
@@ -213,13 +213,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_ldap_settings(cls, cache=False):
 
@@ -810,13 +810,13 @@ class Repository(Base, BaseModel):
 
        required = (MercurialRepository, GitRepository)
 
        if not isinstance(repo, required):
 
            raise Exception('repo must be instance of %s' % (','.join(required)))
 

	
 
        # inject ui extra param to log this action via push logger
 
        for k, v in extras.items():
 
            repo._repo.ui.setconfig('rhodecode_extras', k, v)
 
            repo._repo.ui.setconfig('extras', k, v)
 

	
 
    @classmethod
 
    def is_valid(cls, repo_name):
 
        """
 
        returns True if given repo name is a valid filesystem repository
 

	
kallithea/lib/dbmigrate/schema/db_1_5_2.py
Show inline comments
 
@@ -214,13 +214,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_ldap_settings(cls, cache=False):
 
@@ -876,13 +876,13 @@ class Repository(Base, BaseModel):
 
        required = (MercurialRepository, GitRepository)
 
        if not isinstance(repo, required):
 
            raise Exception('repo must be instance of %s' % (','.join(required)))
 

	
 
        # inject ui extra param to log this action via push logger
 
        for k, v in extras.items():
 
            repo._repo.ui.setconfig('rhodecode_extras', k, v)
 
            repo._repo.ui.setconfig('extras', k, v)
 

	
 
    @classmethod
 
    def is_valid(cls, repo_name):
 
        """
 
        returns True if given repo name is a valid filesystem repository
 

	
kallithea/lib/dbmigrate/schema/db_1_6_0.py
Show inline comments
 
@@ -214,13 +214,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_ldap_settings(cls, cache=False):
 
@@ -974,13 +974,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/dbmigrate/schema/db_1_7_0.py
Show inline comments
 
@@ -219,13 +219,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_ldap_settings(cls, cache=False):
 
@@ -1003,13 +1003,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/dbmigrate/schema/db_1_8_0.py
Show inline comments
 
@@ -221,13 +221,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_ldap_settings(cls, cache=False):
 
@@ -1033,13 +1033,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/dbmigrate/schema/db_2_0_0.py
Show inline comments
 
@@ -262,13 +262,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_auth_plugins(cls, cache=False):
 
@@ -1090,13 +1090,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/dbmigrate/schema/db_2_0_1.py
Show inline comments
 
@@ -265,13 +265,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_auth_plugins(cls, cache=False):
 
@@ -1089,13 +1089,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/dbmigrate/schema/db_2_0_2.py
Show inline comments
 
@@ -265,13 +265,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_auth_plugins(cls, cache=False):
 
@@ -1106,13 +1106,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/dbmigrate/schema/db_2_1_0.py
Show inline comments
 
@@ -268,13 +268,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_auth_plugins(cls, cache=False):
 
@@ -1145,13 +1145,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/dbmigrate/schema/db_2_2_0.py
Show inline comments
 
@@ -269,13 +269,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_auth_plugins(cls, cache=False):
 
@@ -1185,13 +1185,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/dbmigrate/schema/db_2_2_3.py
Show inline comments
 
@@ -269,13 +269,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_auth_plugins(cls, cache=False):
 
@@ -1205,13 +1205,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/lib/middleware/simplegit.py
Show inline comments
 
@@ -128,13 +128,13 @@ class SimpleGit(BaseVCSController):
 
                    username = pre_auth['username']
 
                log.debug('PRE-AUTH got %s as username' % username)
 

	
 
                # If not authenticated by the container, running basic auth
 
                if not username:
 
                    self.authenticate.realm = \
 
                        safe_str(self.config['rhodecode_realm'])
 
                        safe_str(self.config['realm'])
 
                    result = self.authenticate(environ)
 
                    if isinstance(result, str):
 
                        AUTH_TYPE.update(environ, 'basic')
 
                        REMOTE_USER.update(environ, result)
 
                        username = result
 
                    else:
kallithea/lib/middleware/simplehg.py
Show inline comments
 
@@ -132,13 +132,13 @@ class SimpleHg(BaseVCSController):
 
                    username = pre_auth['username']
 
                log.debug('PRE-AUTH got %s as username' % username)
 

	
 
                # If not authenticated by the container, running basic auth
 
                if not username:
 
                    self.authenticate.realm = \
 
                        safe_str(self.config['rhodecode_realm'])
 
                        safe_str(self.config['realm'])
 
                    result = self.authenticate(environ)
 
                    if isinstance(result, str):
 
                        AUTH_TYPE.update(environ, 'basic')
 
                        REMOTE_USER.update(environ, result)
 
                        username = result
 
                    else:
kallithea/model/db.py
Show inline comments
 
@@ -269,13 +269,13 @@ class Setting(Base, BaseModel):
 
            ret = ret.options(FromCache("sql_cache_short", "get_hg_settings"))
 

	
 
        if not ret:
 
            raise Exception('Could not get application settings !')
 
        settings = {}
 
        for each in ret:
 
            settings['rhodecode_' + each.app_settings_name] = \
 
            settings[each.app_settings_name] = \
 
                each.app_settings_value
 

	
 
        return settings
 

	
 
    @classmethod
 
    def get_auth_plugins(cls, cache=False):
 
@@ -1205,13 +1205,13 @@ class Repository(Base, BaseModel):
 
            locked_by=User.get(self.locked[0]).get_api_data() \
 
                if self.locked[0] else None,
 
            locked_date=time_to_datetime(self.locked[1]) \
 
                if self.locked[1] else None
 
        )
 
        rc_config = Setting.get_app_settings()
 
        repository_fields = str2bool(rc_config.get('rhodecode_repository_fields'))
 
        repository_fields = str2bool(rc_config.get('repository_fields'))
 
        if repository_fields:
 
            for f in self.extra_fields:
 
                data[f.field_key_prefixed] = f.field_value
 

	
 
        return data
 

	
kallithea/model/forms.py
Show inline comments
 
@@ -300,37 +300,37 @@ def RepoForkForm(edit=False, old_data={}
 

	
 

	
 
def ApplicationSettingsForm():
 
    class _ApplicationSettingsForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        rhodecode_title = v.UnicodeString(strip=True, not_empty=False)
 
        rhodecode_realm = v.UnicodeString(strip=True, min=1, not_empty=True)
 
        rhodecode_ga_code = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        rhodecode_captcha_public_key = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        rhodecode_captcha_private_key = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        title = v.UnicodeString(strip=True, not_empty=False)
 
        realm = v.UnicodeString(strip=True, min=1, not_empty=True)
 
        ga_code = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        captcha_public_key = v.UnicodeString(strip=True, min=1, not_empty=False)
 
        captcha_private_key = v.UnicodeString(strip=True, min=1, not_empty=False)
 

	
 
    return _ApplicationSettingsForm
 

	
 

	
 
def ApplicationVisualisationForm():
 
    class _ApplicationVisualisationForm(formencode.Schema):
 
        allow_extra_fields = True
 
        filter_extra_fields = False
 
        rhodecode_show_public_icon = v.StringBoolean(if_missing=False)
 
        rhodecode_show_private_icon = v.StringBoolean(if_missing=False)
 
        rhodecode_stylify_metatags = v.StringBoolean(if_missing=False)
 
        show_public_icon = v.StringBoolean(if_missing=False)
 
        show_private_icon = v.StringBoolean(if_missing=False)
 
        stylify_metatags = v.StringBoolean(if_missing=False)
 

	
 
        rhodecode_repository_fields = v.StringBoolean(if_missing=False)
 
        rhodecode_lightweight_journal = v.StringBoolean(if_missing=False)
 
        rhodecode_dashboard_items = v.Int(min=5, not_empty=True)
 
        rhodecode_admin_grid_items = v.Int(min=5, not_empty=True)
 
        rhodecode_show_version = v.StringBoolean(if_missing=False)
 
        rhodecode_use_gravatar = v.StringBoolean(if_missing=False)
 
        rhodecode_gravatar_url = v.UnicodeString(min=3)
 
        rhodecode_clone_uri_tmpl = v.UnicodeString(min=3)
 
        repository_fields = v.StringBoolean(if_missing=False)
 
        lightweight_journal = v.StringBoolean(if_missing=False)
 
        dashboard_items = v.Int(min=5, not_empty=True)
 
        admin_grid_items = v.Int(min=5, not_empty=True)
 
        show_version = v.StringBoolean(if_missing=False)
 
        use_gravatar = v.StringBoolean(if_missing=False)
 
        gravatar_url = v.UnicodeString(min=3)
 
        clone_uri_tmpl = v.UnicodeString(min=3)
 

	
 
    return _ApplicationVisualisationForm
 

	
 

	
 
def ApplicationUiSettingsForm():
 
    class _ApplicationUiSettingsForm(formencode.Schema):
kallithea/templates/admin/settings/settings_global.html
Show inline comments
 
@@ -2,54 +2,54 @@ ${h.form(url('admin_settings_global'), m
 
    <div class="form">
 

	
 
        <div class="fields">
 

	
 
             <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_title">${_('Site branding')}:</label>
 
                    <label for="title">${_('Site branding')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_title',size=30)}
 
                    ${h.text('title',size=30)}
 
                    <span class="help-block">${_('Set a custom title for your Kallithea Service.')}</span>
 
                </div>
 
             </div>
 

	
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_realm">${_('HTTP authentication realm')}:</label>
 
                    <label for="realm">${_('HTTP authentication realm')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_realm',size=30)}
 
                    ${h.text('realm',size=30)}
 
                </div>
 
            </div>
 

	
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_ga_code">${_('Google Analytics code')}:</label>
 
                    <label for="ga_code">${_('Google Analytics code')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_ga_code',size=30)}
 
                    ${h.text('ga_code',size=30)}
 
                </div>
 
            </div>
 

	
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_captcha_public_key">${_('ReCaptcha public key')}:</label>
 
                    <label for="captcha_public_key">${_('ReCaptcha public key')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_captcha_public_key',size=60)}
 
                    ${h.text('captcha_public_key',size=60)}
 
                    <span class="help-block">${_('Public key for reCaptcha system.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_captcha_private_key">${_('ReCaptcha private key')}:</label>
 
                    <label for="captcha_private_key">${_('ReCaptcha private key')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_captcha_private_key',size=60)}
 
                    ${h.text('captcha_private_key',size=60)}
 
                    <span class="help-block">${_('Private key for reCaptcha system. Setting this value will enable captcha on registration')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="buttons">
 
                ${h.submit('save',_('Save settings'),class_="btn")}
kallithea/templates/admin/settings/settings_system.html
Show inline comments
 
@@ -3,13 +3,13 @@
 
 elems = [
 
    (_('Kallithea version'), h.literal('%s <b><span style="color:#036185; text-decoration: underline;cursor: pointer" id="check_for_update" >%s</span></b>' % (c.kallithea_version, _('check for updates'))), ''),
 
    (_('Python version'), c.py_version, ''),
 
    (_('Platform'), c.platform, ''),
 
    (_('GIT version'), c.git_version, ''),
 
    (_('GIT path'), c.ini.get('git_path'), ''),
 
    (_('Upgrade info endpoint'), h.literal('%s <br/><span style="color:#999999">%s.</span>' % (c.rhodecode_update_url, _('Note: please make sure this server can access this url'))), ''),
 
    (_('Upgrade info endpoint'), h.literal('%s <br/><span style="color:#999999">%s.</span>' % (c.update_url, _('Note: please make sure this server can access this url'))), ''),
 
 ]
 
%>
 

	
 
<div id="update_notice" style="display: none">
 
    <div style="padding: 5px 0px 5px 0px; color: #000000; font-weight: bold">${_('Checking for updates...')}</div>
 
</div>
kallithea/templates/admin/settings/settings_visual.html
Show inline comments
 
@@ -6,97 +6,97 @@ ${h.form(url('admin_settings_visual'), m
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label>${_('General')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_repository_fields','True')}
 
                        <label for="rhodecode_repository_fields">${_('Use repository extra fields')}</label>
 
                        ${h.checkbox('repository_fields','True')}
 
                        <label for="repository_fields">${_('Use repository extra fields')}</label>
 
                    </div>
 
                    <span class="help-block">${_('Allows storing additional customized fields per repository.')}</span>
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_show_version','True')}
 
                        <label for="rhodecode_show_version">${_('Show Kallithea version')}</label>
 
                        ${h.checkbox('show_version','True')}
 
                        <label for="show_version">${_('Show Kallithea version')}</label>
 
                    </div>
 
                    <span class="help-block">${_('Shows or hides a version number of Kallithea displayed in the footer.')}</span>
 

	
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_use_gravatar','True')}
 
                        <label for="rhodecode_use_gravatar">${_('Use Gravatars in Kallithea')}</label>
 
                        ${h.checkbox('use_gravatar','True')}
 
                        <label for="use_gravatar">${_('Use Gravatars in Kallithea')}</label>
 
                    </div>
 
                </div>
 
                <div class="field">
 
                    <div class="input">
 
                        ${h.text('rhodecode_gravatar_url', size=80)}
 
                        ${h.text('gravatar_url', size=80)}
 
                        <span class="help-block">${_('''Gravatar url allows you to use other avatar server application.
 
                                                        Following variables of the URL will be replaced accordingly.
 
                                                        {scheme}    'http' or 'https' sent from running Kallithea server,
 
                                                        {email}     user email,
 
                                                        {md5email}  md5 hash of the user email (like at gravatar.com),
 
                                                        {size}      size of the image that is expected from the server application,
 
                                                        {netloc}    network location/server host of running Kallithea server''')}</span>
 
                    </div>
 
                </div>
 
                <div class="field">
 
                    <div class="input">
 
                        ${h.text('rhodecode_clone_uri_tmpl', size=80)}
 
                        ${h.text('clone_uri_tmpl', size=80)}
 
                        <span class="help-block">${_('''Schema of clone url construction eg. '{scheme}://{user}@{netloc}/{repo}', available vars:
 
                                                        {scheme} 'http' or 'https' sent from running Kallithea server,
 
                                                        {user}   current user username,
 
                                                        {netloc} network location/server host of running Kallithea server,
 
                                                        {repo}   full repository name,
 
                                                        {repoid} ID of repository, can be used to contruct clone-by-id''')}</span>
 
                    </div>
 
                </div>
 
             </div>
 

	
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_dashboard_items">${_('Dashboard items')}:</label>
 
                    <label for="dashboard_items">${_('Dashboard items')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_dashboard_items',size=5)}
 
                    ${h.text('dashboard_items',size=5)}
 
                    <span class="help-block">${_('Number of items displayed in the main page dashboard before pagination is shown.')}</span>
 
                </div>
 
            </div>
 

	
 
            <div class="field">
 
                <div class="label">
 
                    <label for="rhodecode_admin_grid_items">${_('Admin pages items')}:</label>
 
                    <label for="admin_grid_items">${_('Admin pages items')}:</label>
 
                </div>
 
                <div class="input">
 
                    ${h.text('rhodecode_admin_grid_items',size=5)}
 
                    ${h.text('admin_grid_items',size=5)}
 
                    <span class="help-block">${_('Number of items displayed in the admin pages grids before pagination is shown.')}</span>
 
                </div>
 
            </div>
 

	
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label>${_('Icons')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_show_public_icon','True')}
 
                        <label for="rhodecode_show_public_icon">${_('Show public repo icon on repositories')}</label>
 
                        ${h.checkbox('show_public_icon','True')}
 
                        <label for="show_public_icon">${_('Show public repo icon on repositories')}</label>
 
                    </div>
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_show_private_icon','True')}
 
                        <label for="rhodecode_show_private_icon">${_('Show private repo icon on repositories')}</label>
 
                        ${h.checkbox('show_private_icon','True')}
 
                        <label for="show_private_icon">${_('Show private repo icon on repositories')}</label>
 
                    </div>
 
                    <span class="help-block">${_('Show public/private icons next to repositories names.')}</span>
 
                 </div>
 
             </div>
 

	
 
             <div class="field">
 
                <div class="label label-checkbox">
 
                    <label>${_('Meta-Tagging')}:</label>
 
                </div>
 
                <div class="checkboxes">
 
                    <div class="checkbox">
 
                        ${h.checkbox('rhodecode_stylify_metatags','True')}
 
                        <label for="rhodecode_stylify_metatags">${_('Stylify recognised meta tags:')}</label>
 
                        ${h.checkbox('stylify_metatags','True')}
 
                        <label for="stylify_metatags">${_('Stylify recognised meta tags:')}</label>
 
                    </div>
 
                    <div style="padding-left: 20px;">
 
                        <ul> <!-- Fix style here -->
 
                            <li>[featured] <span class="metatag" tag="featured">featured</span></li>
 
                            <li>[stale] <span class="metatag" tag="stale">stale</span></li>
 
                            <li>[dead] <span class="metatag" tag="dead">dead</span></li>
kallithea/tests/functional/test_admin_settings.py
Show inline comments
 
@@ -77,103 +77,103 @@ class TestAdminSettingsController(TestCo
 
    def test_ga_code_active(self):
 
        self.log_user()
 
        old_title = 'Kallithea'
 
        old_realm = 'Kallithea authentication'
 
        new_ga_code = 'ga-test-123456789'
 
        response = self.app.post(url('admin_settings_global'),
 
                        params=dict(rhodecode_title=old_title,
 
                                 rhodecode_realm=old_realm,
 
                                 rhodecode_ga_code=new_ga_code,
 
                                 rhodecode_captcha_private_key='',
 
                                 rhodecode_captcha_public_key='',
 
                        params=dict(title=old_title,
 
                                 realm=old_realm,
 
                                 ga_code=new_ga_code,
 
                                 captcha_private_key='',
 
                                 captcha_public_key='',
 
                                 ))
 

	
 
        self.checkSessionFlash(response, 'Updated application settings')
 

	
 
        self.assertEqual(Setting
 
                         .get_app_settings()['rhodecode_ga_code'], new_ga_code)
 
                         .get_app_settings()['ga_code'], new_ga_code)
 

	
 
        response = response.follow()
 
        response.mustcontain("""_gaq.push(['_setAccount', '%s']);""" % new_ga_code)
 

	
 
    def test_ga_code_inactive(self):
 
        self.log_user()
 
        old_title = 'Kallithea'
 
        old_realm = 'Kallithea authentication'
 
        new_ga_code = ''
 
        response = self.app.post(url('admin_settings_global'),
 
                        params=dict(rhodecode_title=old_title,
 
                                 rhodecode_realm=old_realm,
 
                                 rhodecode_ga_code=new_ga_code,
 
                                 rhodecode_captcha_private_key='',
 
                                 rhodecode_captcha_public_key='',
 
                        params=dict(title=old_title,
 
                                 realm=old_realm,
 
                                 ga_code=new_ga_code,
 
                                 captcha_private_key='',
 
                                 captcha_public_key='',
 
                                 ))
 

	
 
        self.checkSessionFlash(response, 'Updated application settings')
 
        self.assertEqual(Setting
 
                        .get_app_settings()['rhodecode_ga_code'], new_ga_code)
 
                        .get_app_settings()['ga_code'], new_ga_code)
 

	
 
        response = response.follow()
 
        response.mustcontain(no=["_gaq.push(['_setAccount', '%s']);" % new_ga_code])
 

	
 
    def test_captcha_activate(self):
 
        self.log_user()
 
        old_title = 'Kallithea'
 
        old_realm = 'Kallithea authentication'
 
        new_ga_code = ''
 
        response = self.app.post(url('admin_settings_global'),
 
                        params=dict(rhodecode_title=old_title,
 
                                 rhodecode_realm=old_realm,
 
                                 rhodecode_ga_code=new_ga_code,
 
                                 rhodecode_captcha_private_key='1234567890',
 
                                 rhodecode_captcha_public_key='1234567890',
 
                        params=dict(title=old_title,
 
                                 realm=old_realm,
 
                                 ga_code=new_ga_code,
 
                                 captcha_private_key='1234567890',
 
                                 captcha_public_key='1234567890',
 
                                 ))
 

	
 
        self.checkSessionFlash(response, 'Updated application settings')
 
        self.assertEqual(Setting
 
                        .get_app_settings()['rhodecode_captcha_private_key'], '1234567890')
 
                        .get_app_settings()['captcha_private_key'], '1234567890')
 

	
 
        response = self.app.get(url('register'))
 
        response.mustcontain('captcha')
 

	
 
    def test_captcha_deactivate(self):
 
        self.log_user()
 
        old_title = 'Kallithea'
 
        old_realm = 'Kallithea authentication'
 
        new_ga_code = ''
 
        response = self.app.post(url('admin_settings_global'),
 
                        params=dict(rhodecode_title=old_title,
 
                                 rhodecode_realm=old_realm,
 
                                 rhodecode_ga_code=new_ga_code,
 
                                 rhodecode_captcha_private_key='',
 
                                 rhodecode_captcha_public_key='1234567890',
 
                        params=dict(title=old_title,
 
                                 realm=old_realm,
 
                                 ga_code=new_ga_code,
 
                                 captcha_private_key='',
 
                                 captcha_public_key='1234567890',
 
                                 ))
 

	
 
        self.checkSessionFlash(response, 'Updated application settings')
 
        self.assertEqual(Setting
 
                        .get_app_settings()['rhodecode_captcha_private_key'], '')
 
                        .get_app_settings()['captcha_private_key'], '')
 

	
 
        response = self.app.get(url('register'))
 
        response.mustcontain(no=['captcha'])
 

	
 
    def test_title_change(self):
 
        self.log_user()
 
        old_title = 'Kallithea'
 
        new_title = old_title + '_changed'
 
        old_realm = 'Kallithea authentication'
 

	
 
        for new_title in ['Changed', 'Żółwik', old_title]:
 
            response = self.app.post(url('admin_settings_global'),
 
                        params=dict(rhodecode_title=new_title,
 
                                 rhodecode_realm=old_realm,
 
                                 rhodecode_ga_code='',
 
                                 rhodecode_captcha_private_key='',
 
                                 rhodecode_captcha_public_key='',
 
                        params=dict(title=new_title,
 
                                 realm=old_realm,
 
                                 ga_code='',
 
                                 captcha_private_key='',
 
                                 captcha_public_key='',
 
                                ))
 

	
 
            self.checkSessionFlash(response, 'Updated application settings')
 
            self.assertEqual(Setting
 
                             .get_app_settings()['rhodecode_title'],
 
                             .get_app_settings()['title'],
 
                             new_title.decode('utf-8'))
 

	
 
            response = response.follow()
 
            response.mustcontain("""<div class="branding">- %s</div>""" % new_title)
0 comments (0 inline, 0 general)