def fetch_settings(cls): LodelContext.expose_dyncode(globals(), 'dyncode') if cls._infos_fields is None: cls._infos_fields = list() else: # Already fetched return infos = (Settings.auth.login_classfield, Settings.auth.pass_classfield) res_infos = [] for clsname, fieldname in infos: dcls = dyncode.lowername2class(infos[0][0]) res_infos.append((dcls, infos[1][1])) link_field = None if res_infos[0][0] != res_infos[1][0]: # login and password are in two separated EmClass # determining the field that links login EmClass to password # EmClass for fname, fdh in res_infos[0][0].fields(True).items(): if fdh.is_reference( ) and res_infos[1][0] in fdh.linked_classes(): link_field = fname if link_field is None: # Unable to find link between login & password EmClass raise AuthenticationError("Unable to find a link between \ login EmClass '%s' and password EmClass '%s'. Abording..." % (res_infos[0][0], res_infos[1][0])) res_infos[0] = (res_infos[0][0], res_infos[0][1], link_field) cls._infos_fields.append({ 'login': res_infos[0], 'password': res_infos[1] })
# 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 Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # import jinja2 import os from lodel.context import LodelContext LodelContext.expose_modules(globals(), {'lodel.settings': ['Settings']}) LodelContext.expose_dyncode(globals()) from ...client import WebUiClient as WebUiClient from .api import api_lodel_templates from .exceptions.not_allowed_custom_api_key_error import NotAllowedCustomAPIKeyError from ...main import root_url as root_url from ...main import static_url as static_url from ...main import PLUGIN_PATH TEMPLATE_PATH = os.path.realpath(os.path.join(PLUGIN_PATH, 'templates/')) class TemplateLoader(object): _reserved_template_keys = ['lodel']
# along with this program. If not, see <http://www.gnu.org/licenses/>. # from ...exceptions import * from .base import get_response from lodel.context import LodelContext LodelContext.expose_modules( globals(), { 'lodel.leapi.exceptions': [], 'lodel.logger': 'logger', 'lodel.leapi.datahandlers.base_classes': ['MultipleRef'], 'lodel.leapi.exceptions': ['LeApiDataCheckErrors'], 'lodel.exceptions': ['LodelExceptions'] }) LodelContext.expose_dyncode(globals(), 'dyncode') from ...client import WebUiClient import warnings LIST_SEPARATOR = ',' ##@brief These functions are called by the rules defined in ../urls.py ## To administrate the instance of the editorial model ##@brief Controller's function to redirect on the home page of the admin # @param request : the request (get or post) # @note the response is given in a html page called in get_response_function def index_admin(request): # We have to be identified to admin the instance