本文整理汇总了Python中tg.TGController类的典型用法代码示例。如果您正苦于以下问题:Python TGController类的具体用法?Python TGController怎么用?Python TGController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TGController类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
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)
开发者ID:desarrollo1,项目名称:tg2env,代码行数:9,代码来源:activeform.py
示例2: __call__
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
开发者ID:preinh,项目名称:seisPortal,代码行数:25,代码来源:base.py
示例3: __call__
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)
开发者ID:ralphbean,项目名称:fedora-tagger,代码行数:28,代码来源:base.py
示例4: __call__
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)
开发者ID:rwilcox,项目名称:turbogears2_webservices_example,代码行数:7,代码来源:base.py
示例5: __call__
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)
开发者ID:SergeyLashin,项目名称:mediacore,代码行数:8,代码来源:root.py
示例6: __call__
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)
开发者ID:ralphbean,项目名称:hanginwit-threebean,代码行数:8,代码来源:base.py
示例7: __call__
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)
开发者ID:enriquebits,项目名称:bookmanizer,代码行数:8,代码来源:base.py
示例8: __call__
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)
开发者ID:ralphbean,项目名称:moksha-and-tg,代码行数:12,代码来源:base.py
示例9: __call__
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)
开发者ID:TurboGears,项目名称:tg2tut,代码行数:12,代码来源:base.py
示例10: __call__
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)
开发者ID:jorgeramirez,项目名称:LPM,代码行数:53,代码来源:base.py
示例11: __call__
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)
开发者ID:mokshaproject,项目名称:moksha-turbogears2-hello_world,代码行数:13,代码来源:base.py
示例12: __call__
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)
开发者ID:sysnux,项目名称:astportal,代码行数:14,代码来源:base.py
示例13: __call__
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
开发者ID:arianepaola,项目名称:tg2jython,代码行数:15,代码来源:dbmechanic.py
示例14: __call__
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)
开发者ID:ralphbean,项目名称:monroe,代码行数:16,代码来源:base.py
示例15: __call__
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)
开发者ID:ralphbean,项目名称:tw2-facemelt-tg2.1,代码行数:19,代码来源:base.py
示例16: __call__
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)
开发者ID:lmacken,项目名称:moksha,代码行数:21,代码来源:base.py
示例17: __call__
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)
开发者ID:MrPetru,项目名称:spam,代码行数:22,代码来源:base.py
示例18: __call__
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)
开发者ID:lmacken,项目名称:fedora-tagger,代码行数:23,代码来源:base.py
示例19: __call__
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)
开发者ID:fedora-infra,项目名称:busmon,代码行数:4,代码来源:base.py
示例20: __call__
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)
开发者ID:lento,项目名称:tagger,代码行数:73,代码来源:base.py
注:本文中的tg.TGController类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论