Example #1
0
 def __init__(self, form, onSuccessFunc=None, *args, **kw):
     """(form, onSuccessFunc=None, *args, **kw)
     This class creates a handler which handles all of the 
     
     
     """
     self.form = form
     self.onSuccessFunc = onSuccessFunc
     TGController.__init__(self, args, kw)
Example #2
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity

        # Include jquery on every page.
        tw2.jquery.jquery_js.req().prepare()

        # Set the theme to 'hot-sneaks'
        tw2.jqplugins.ui.set_ui_theme_name('hot-sneaks')

        if 'login' not in environ['PATH_INFO']:
            for link in ["query.js", "cards.js", "navigation.js"]:
                twc.JSLink(link="javascript/%s" % link).req().prepare()

            tmpl_context.hotkeys_dialog = HotkeysDialog
            tmpl_context.search_dialog = SearchDialog
            tmpl_context.leaderboard_dialog = LeaderboardDialog
            tmpl_context.statistics_dialog = StatisticsDialog
            tmpl_context.user_widget = UserWidget
            if request.identity:
                tmpl_context.add_dialog = AddTagDialog

        return TGController.__call__(self, environ, start_response)
Example #3
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity

        #return TGController.__call__(self, environ, start_response)
        stream = TGController.__call__(self, environ, start_response)
         
        # Disable the injection of tw2.jquery
        #offending_link = tw2.jquery.jquery_js.req().link
        local = tw2.core.core.request_local()

        res = []
        for r in local.get('resources', list()):
            #if r.link != offending_link:
            r.link = url(r.link)
            res.append(r)
        
        local['resources'] = res    
            
        return stream
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        return TGController.__call__(self, environ, start_response)
Example #5
0
    def __call__(self, environ, start_response):
        environ['request_body'] = start_response.request.body
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        return TGController.__call__(self, environ, start_response)
Example #6
0
 def __call__(self, environ, start_response):
     """Invoke the Controller"""
     # TGController.__call__ dispatches to the Controller method
     # the request is routed to. This routing information is
     # available in environ['pylons.routes_dict']
     request.identity = request.environ.get("repoze.who.identity")
     tmpl_context.identity = request.identity
     return TGController.__call__(self, environ, start_response)
Example #7
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        tmpl_context.in_production = asbool(config.get('in_production'))
        return TGController.__call__(self, environ, start_response)
Example #8
0
    def __call__(self, environ, context):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to.

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity
        return TGController.__call__(self, environ, context)
Example #9
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity
        tmpl_context.rst_to_html = rst_to_html
        tmpl_context.gaid = config.get('ga_verifier', None)
        tmpl_context.analyticsid = config.get('analyticsid', None)
        return TGController.__call__(self, environ, start_response)
Example #10
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        #tmpl_context.notif = mokshaandtg.widgets.NotificationWidget(id='foo').display()
        tmpl_context.notif = moksha.utils.get_widget('garbage').display()
        # I want to use my own lib/base
        tmpl_context.globs = moksha.lib.base.global_resources()

        return TGController.__call__(self, environ, start_response)
Example #11
0
 def __call__(self, environ, start_response):
     """Invoke the Controller"""
     # TGController.__call__ dispatches to the Controller method
     # the request is routed to. This routing information is
     # available in environ['pylons.routes_dict']
     
     try:
         return TGController.__call__(self, environ, start_response)
     finally:
         #after everything is done clear out the Database Session
         #to eliminate possible cross request DBSession polution.
         model.DBSession.remove()
Example #12
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        # para acceder mas rapido a este componente
        request.credentials = request.environ.get('repoze.what.credentials')
        request.puede_gestion_conf = False
        request.puede_desarrollo = False
        
        if request.credentials:
            username = request.credentials["repoze.what.userid"]
            usuario = model.Usuario.by_user_name(username)
            request.puede_proyecto = False
            request.puede_rol = False
            request.puede_fase = False
            request.puede_ti = False
            request.puede_busqueda = False
            
            if AlgunPermiso(tipo="Rol").is_met(request.environ):
                request.puede_rol = True

            perms = request.credentials["permissions"]
            if perms.count("crear proyecto") or \
               perms.count("modificar proyecto") or \
               perms.count("eliminar proyecto"):
                request.puede_proyecto = True
            
            if perms.count("modificar fase"):
                request.puede_fase = True
            
            if perms.count("crear tipo item") or \
               perms.count("redefinir tipo item"):
                request.puede_ti = True
            
            if AlgunPermiso(tipo="Usuario").is_met(request.environ):
                request.puede_busqueda = True
                
            if AlgunPermiso(tipo="Tipo").is_met(request.environ):
                request.puede_desarrollo = True
                
            if has_any_permission(u"crear lb", u"abrir-cerrar lb", 
                                  u"consultar lb").is_met(request.environ):
                request.puede_gestion_conf = True
			
        tmpl_context.identity = request.identity
#        session['atras'] = session['actual']
#        session['actual'] = session['adelante']
        
        session.save()
        return TGController.__call__(self, environ, start_response)
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity

        tmpl_context.notification_widget = tutorial.widgets.PopupNotification
        tmpl_context.moksha_global_resources = global_resources

        return TGController.__call__(self, environ, start_response)
Example #14
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity
        jquery_js.inject()
#        from tw.jquery.ui import ui_tabs_js, jquery_ui_all_js
#        from tw.uitheme import uilightness_css
#        jquery_ui_all_js.inject()
#        uilightness_css.inject()
        return TGController.__call__(self, environ, start_response)
Example #15
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # Create a container to send widgets to the template. Only those sent
        # in here will have their resources automatically included in the
        # template
        context.w = WidgetBunch()
        context.css = dbsprocketsCss
        try:
            return TGController.__call__(self, environ, start_response)
        finally:
            pass
Example #16
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        # Create a container to send widgets to the template. Only those sent
        # in here will have their resources automatically included in the
        # template
        try:
            return TGController.__call__(self, environ, start_response)
        finally:
            # after everything is done clear out the Database Session
            # to eliminate possible cross request DBSession polution.
            model.DBSession.remove()
Example #17
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity

        tmpl_context.menu_widget = MainMenu
        tmpl_context.dialog_widget = ReadmeDialog
        tmpl_context.from_date_widget = FromDateWidget
        tmpl_context.to_date_widget = ToDateWidget
        set_ui_theme_name('excite-bike')

        return TGController.__call__(self, environ, start_response)
Example #18
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        set_ui_theme_name('hot-sneaks')

        entry = model.ServerHit(
            remote_addr=environ['REMOTE_ADDR'],
            path_info=environ['PATH_INFO'],
            query_string=environ['QUERY_STRING'],
        )
        model.DBSession.add(entry)
        model.DBSession.flush()

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity
        return TGController.__call__(self, environ, start_response)
Example #19
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity

        # we alias this for easy use in templates
        tmpl_context.auth = eval_and_check_predicates

        # url is already taken
        tmpl_context.get_url = url

        # Add our global widget to the template context, and register it's
        # resources
        tmpl_context.moksha_global_resources = moksha.global_resources

        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict'], which is currently
        # being set in moksha.wsgiapp
        return TGController.__call__(self, environ, start_response)
Example #20
0
File: base.py Project: MrPetru/spam
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity
        if request.identity:
            tmpl_context.user = request.identity['user']

        # set the theme
        tmpl_context.theme = config.get('theme', 'default')

        # widgets
        tmpl_context.w_startup_js = w_startup_js
        tmpl_context.l_projects = l_projects

        # custom predicates
        tmpl_context.predicates = predicates

        return TGController.__call__(self, environ, start_response)
Example #21
0
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity

        # Include jquery on every page.
        tw2.jquery.jquery_js.req().prepare()

        if 'login' not in environ['PATH_INFO']:
            for link in ["query.js", "cards.js", "navigation.js"]:
                twc.JSLink(link="javascript/%s" % link).req().prepare()

            tmpl_context.hotkeys_dialog = fedoratagger.widgets.dialog.HotkeysDialog
            tmpl_context.search_dialog = fedoratagger.widgets.dialog.SearchDialog
            tmpl_context.add_dialog = fedoratagger.widgets.dialog.AddTagDialog
            tmpl_context.leaderboard_dialog = fedoratagger.widgets.dialog.LeaderboardDialog
            tmpl_context.user_widget = fedoratagger.widgets.user.UserWidget

        return TGController.__call__(self, environ, start_response)
Example #22
0
 def __call__(self, environ, start_response):
     tmpl_context.moksha_socket = \
         moksha.wsgi.widgets.api.get_moksha_socket(config)
     return TGController.__call__(self, environ, start_response)
Example #23
0
File: base.py Project: lento/tagger
    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']

        identity = request.environ.get('repoze.who.identity')
        request.identity = identity
        tmpl_context.identity = identity
        tmpl_context.user = identity and identity['user'] or False

        # get settings from the db
        settings = dict([(s.id, s.value) for s in DBSession.query(Setting)])

        # set theme, title and copyright notice
        tmpl_context.theme = (settings.get('theme') or
                              config.get('theme') or
                              'default'
                             )
        tmpl_context.title = (settings.get('title') or
                              config.get('title', '').strip('\"') or
                              ''
                             )
        tmpl_context.copyright = (settings.get('copyright') or
                                  config.get('copyright', '').strip('\"') or
                                  ''
                                 )
        tmpl_context.cc = (settings.get('cc') or
                           config.get('cc', '').strip('\"') or
                           ''
                          )

        # load javascripts
        jquery_js.inject()
        jquery_tools_js.inject()
        tagger_js.inject()
        springs_js.inject()
        mjs_js.inject()

        # add languages and categories to template context (used in the header)
        tmpl_context.languages = DBSession.query(Language)
        tmpl_context.categories = DBSession.query(Category)

        # set language
        if 'lang' in request.cookies:
            tmpl_context.lang = request.cookies['lang']
            i18n.set_lang(tmpl_context.lang)
        else:
            tmpl_context.lang = config.get('lang', None)
            i18n.set_lang(None)

        # add current url to template context
        tmpl_context.current_url = request.url

        # set logo
        l_mediaid = settings.get(u'logo_media', None)
        l_media = l_mediaid and DBSession.query(Media).get(l_mediaid)
        l_mediaurl = l_media and url('/%s/%s' % (G.upload_prefix, l_media.uri))
        tmpl_context.logo_mediaurl = l_mediaurl

        # set banner link and background image
        tmpl_context.w_link = w_link
        tmpl_context.w_media = w_media
        tmpl_context.banner_linkid = settings.get(u'banner_link', None)
        b_mediaid = settings.get(u'banner_media', None)
        b_media = b_mediaid and DBSession.query(Media).get(b_mediaid)
        b_mediaurl = b_media and url('/%s/%s' % (G.upload_prefix, b_media.uri))
        tmpl_context.banner_mediaurl = b_mediaurl

        # add Sidebar widgets
        tmpl_context.w_sideobj = w_sideobj

        return TGController.__call__(self, environ, start_response)
Example #24
0
File: base.py Project: smarkm/ovm
 def __call__(self, environ, start_response):
     request.identity = request.environ.get('repoze.who.identity')
     tmpl_context.identity = request.identity
     return TGController.__call__(self, environ, start_response)
    def __call__(self, environ, context):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to.

        return TGController.__call__(self, environ, context)
Example #26
0
    def __call__(self, environ, context):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to.

        return TGController.__call__(self, environ, context)
Example #27
0
 def __call__(self, environ, start_response):
     """Invoke the Controller"""
     request.identity = request.environ.get("repoze.who.identity")
     tmpl_context.identity = request.identity
     return TGController.__call__(self, environ, start_response)