本文整理汇总了Python中tg.TGController.__call__方法的典型用法代码示例。如果您正苦于以下问题:Python TGController.__call__方法的具体用法?Python TGController.__call__怎么用?Python TGController.__call__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tg.TGController
的用法示例。
在下文中一共展示了TGController.__call__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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
示例2: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例3: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例4: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例5: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例6: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例7: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例8: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例9: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例10: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例11: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例12: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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
示例13: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例14: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)
示例15: __call__
# 需要导入模块: from tg import TGController [as 别名]
# 或者: from tg.TGController import __call__ [as 别名]
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)