Beispiel #1
0
    def __init__(self, request):
        self.request = request
        self.__parent__ = None
        self.title = 'Admin'

        if self.__admin_menu__:
            admin_menu = self.__admin_menu__
        else:
            models = request.registry.getUtilitiesFor(IModel)
            admin_menu = sorted([name for name, ob in models])
        admin_menu = [
            get_model_config(self.request, name)
            for name in admin_menu]

        request.route_name = self.__fa_route_name__
        request.session_factory = self.__session_factory__
        request.query_factory = self.__query_factory__
        request.fa_url = self.fa_url
        request.model_instance = None
        request.model_class = None
        request.model_name = None
        request.model_id = None
        request.relation = None
        request.format = 'html'
        request.admin_menu = admin_menu

        request.current_user = get_current_user(self.request)

        request.actions = actions.RequestActions()

        from js.bootstrap import bootstrap
        bootstrap.need()
Beispiel #2
0
def forbidden_view(request):
    """
    The forbidden view :
        * handles the redirection to login form
        * return a json dict in case of xhr requests

    :param obj request: The pyramid request object
    """
    log.debug("We are in a forbidden view")
    login = authenticated_userid(request)

    if login:
        log.warn(u"An access has been forbidden to '{0}'".format(login))
        bootstrap.need()
        return_datas = {
            "title": u"Accès refusé",
        }

    else:
        log.debug(u"An access has been forbidden to an unauthenticated user")
        # redirecting to the login page with the current path as param
        loc = request.route_url('login', _query=(('nextpage', request.path), ))
        if request.is_xhr:
            return_datas = dict(redirect=loc)
        else:
            return_datas = HTTPFound(location=loc)

    return return_datas
Beispiel #3
0
    def __init__(self, context, request):
        self.context = context
        self.request = request

        jquery.need()
        modernizr.need()
        bootstrap.need()
Beispiel #4
0
def forbidden_view(request):
    """
    The forbidden view :
        * handles the redirection to login form
        * return a json dict in case of xhr requests

    :param obj request: The pyramid request object
    """
    log.debug("We are in a forbidden view")
    login = authenticated_userid(request)

    if login:
        log.warn(u"An access has been forbidden to '{0}'".format(login))
        bootstrap.need()
        return_datas = {"title": u"Accès refusé", }

    else:
        log.debug(u"An access has been forbidden to an unauthenticated user")
        # redirecting to the login page with the current path as param
        loc = request.route_url('login', _query=(('nextpage', request.path),))
        if request.is_xhr:
            return_datas = dict(redirect=loc)
        else:
            return_datas = HTTPFound(location=loc)

    return return_datas
Beispiel #5
0
def dashboard_view(request):
    bootstrap.need()
    jqueryui.need()
    jqueryui_theme.need()
    region = request.context.get_current_region()
    instances = request.context.get_instances_by_region(region)
    return {
        "instances": instances,
        "current_region": region,
        }
Beispiel #6
0
 def __call__(self):
     bootstrap.need()
     word_cloud_js.need()
     return {
         'counts': {
             'messages': self.dbsession.query(Message).count(),
             'sources': self.dbsession.query(Source).count()
         },
         'no_refresh': 'norefresh' in self.request.GET
     }
Beispiel #7
0
 def update(self):
     plugin_auth = component.getUtility(IAuthenticatorPlugin,
                                        'autenticacion')
     bootstrap.need()
     resource.style.need()
     self.usuarios = plugin_auth.listarUsuarios()
Beispiel #8
0
    def __init__(self, config, request):
        self.config = config
        self.request = request

        bootstrap.need()
Beispiel #9
0
        def __init__(self, request):
            request.session_factory = session_factory

            from js.bootstrap import bootstrap
            bootstrap.need()
Beispiel #10
0
 def update(self):
     bootstrap.need()
     resource.style.need()
     self.site = grok.getApplication()
Beispiel #11
0
def main(request):
    bootstrap.need()
    return {}
    pass
Beispiel #12
0
 def update(self):
     bootstrap.need()
     resource.style.need()
     self.site = grok.getApplication()
Beispiel #13
0
 def update(self, seccion=None):
     bootstrap.need()
     resource.style.need()
     if not seccion:
         return
     self.context.borrar_seccion(seccion)
Beispiel #14
0
 def update(self, seccion=None):
     bootstrap.need()
     resource.style.need()
     if not seccion:
         return
     self.context.borrar_seccion(seccion)
Beispiel #15
0
def index(request):
    from js.bootstrap import bootstrap
    bootstrap.need()
    return {}
def load_fanstatic(event):
    modernizr.need()
    bootstrap.need()
Beispiel #17
0
 def update(self):
     bootstrap.need()
     resource.style.need()
Beispiel #18
0
 def render(self):
     bootstrap.need()
     return self.get_context()