Files
@ 15a12f2a47b4
Branch filter:
Location: kallithea/kallithea/controllers/admin/defaults.py - annotation
15a12f2a47b4
3.1 KiB
text/x-python
jenkinsfile: delete all old files in the workspace
Especial important when files have been renamed and there are *.pyc files
left over from the last build.
Especial important when files have been renamed and there are *.pyc files
left over from the last build.
d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e 24c0d584ba86 d1addaf7a91e 1948ede028ef 1948ede028ef d1addaf7a91e d1addaf7a91e 1948ede028ef ad38f9f93b3b d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e af3539a458f6 d1addaf7a91e d9b78d8f1db3 d1addaf7a91e af3539a458f6 d1addaf7a91e 09bcde0eee6d d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e 9daad8c50b37 d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e 09bcde0eee6d d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e 9daad8c50b37 d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e 9daad8c50b37 d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d69aa464f373 d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e c04c2734e32f c04c2734e32f d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d1addaf7a91e d9b78d8f1db3 | # -*- coding: utf-8 -*-
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
kallithea.controllers.admin.defaults
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
default settings controller for Kallithea
This file was forked by the Kallithea project in July 2014.
Original author and date, and relevant copyright and licensing information is below:
:created_on: Apr 27, 2010
:author: marcink
:copyright: (c) 2013 RhodeCode GmbH, and others.
:license: GPLv3, see LICENSE.md for more details.
"""
import logging
import traceback
import formencode
from formencode import htmlfill
from pylons import request, tmpl_context as c
from pylons.i18n.translation import _
from webob.exc import HTTPFound
from kallithea.config.routing import url
from kallithea.lib import helpers as h
from kallithea.lib.auth import LoginRequired, HasPermissionAnyDecorator
from kallithea.lib.base import BaseController, render
from kallithea.model.forms import DefaultsForm
from kallithea.model.meta import Session
from kallithea import BACKENDS
from kallithea.model.db import Setting
log = logging.getLogger(__name__)
class DefaultsController(BaseController):
@LoginRequired()
@HasPermissionAnyDecorator('hg.admin')
def __before__(self):
super(DefaultsController, self).__before__()
def index(self, format='html'):
c.backends = BACKENDS.keys()
defaults = Setting.get_default_repo_settings()
return htmlfill.render(
render('admin/defaults/defaults.html'),
defaults=defaults,
encoding="UTF-8",
force_defaults=False
)
def update(self, id):
_form = DefaultsForm()()
try:
form_result = _form.to_python(dict(request.POST))
for k, v in form_result.iteritems():
setting = Setting.create_or_update(k, v)
Session().commit()
h.flash(_('Default settings updated successfully'),
category='success')
except formencode.Invalid as errors:
defaults = errors.value
return htmlfill.render(
render('admin/defaults/defaults.html'),
defaults=defaults,
errors=errors.error_dict or {},
prefix_error=False,
encoding="UTF-8",
force_defaults=False)
except Exception:
log.error(traceback.format_exc())
h.flash(_('Error occurred during update of defaults'),
category='error')
raise HTTPFound(location=url('defaults'))
|