本文整理汇总了Python中pylons.templating.render_mako函数的典型用法代码示例。如果您正苦于以下问题:Python render_mako函数的具体用法?Python render_mako怎么用?Python render_mako使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render_mako函数的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: index
def index(self):
if self.eventid and self.eventid.isdigit():
return render_mako("/admin/event.mako")
elif self.database is not None:
c.text = "<h2>%s Adminstration</h2>" % self.routingargs["database"]
return render_mako("/admin/simple.mako")
else:
c.files = map(os.path.basename, glob.glob("%s/*.db" % (config["seriesdir"])))
return render_mako("/databaseselect.mako")
开发者ID:adrianpike,项目名称:wwscc,代码行数:9,代码来源:admin.py
示例2: index
def index(self):
if self.eventid:
return render_mako("/announcer/main.mako")
elif self.database is not None:
c.events = self.session.query(Event).all()
return render_mako("/eventselect.mako")
else:
c.files = map(os.path.basename, glob.glob("%s/*.db" % (config["seriesdir"])))
return render_mako("/databaseselect.mako")
开发者ID:adrianpike,项目名称:wwscc,代码行数:9,代码来源:announcer.py
示例3: index
def index(self):
if c.event:
c.challenges = self.session.query(Challenge).filter(Challenge.eventid==c.event.id).all()
return render_mako('/resultsindex.mako')
elif self.database is not None:
c.events = self.session.query(Event).all()
return render_mako('/eventselect.mako')
else:
c.files = map(os.path.basename, glob.glob('%s/*.db' % (config['seriesdir'])))
return render_mako('/databaseselect.mako')
开发者ID:dpodhola,项目名称:wwscc,代码行数:10,代码来源:results.py
示例4: view
def view(self):
id = request.GET.get('event', None)
if id is None:
return render_mako('/register/eventselect.mako')
c.classdata = ClassData(self.session)
c.event = self.session.query(Event).get(id)
query = self.session.query(Driver,Car,Registration).join('cars', 'registration').filter(Registration.eventid==id)
query = query.order_by(Car.classcode, Car.number)
c.reglist = query.all()
return render_mako('/register/reglist.mako')
开发者ID:adrianpike,项目名称:wwscc,代码行数:11,代码来源:register.py
示例5: render
def render(name, *args, **kwargs):
if request.user_agent and any([x in request.user_agent for x in ('iPhone','webOS', 'Android')]):
if 'use_non_mobile' in request.params:
session['use_non_mobile'] = (request.params['use_non_mobile'] ==
'yes')
if session.get('use_non_mobile'):
c.mobile_client = True
else:
try:
return render_mako('/mobile' + name, *args, **kwargs)
except TopLevelLookupException:
# If a mobile template doesn't exist for this page, don't show
# the 'use mobile interface' link.
c.mobile_client = False
return render_mako(name, *args, **kwargs)
开发者ID:andersk,项目名称:bluechips,代码行数:15,代码来源:base.py
示例6: render
def render(*args, **kargs):
if args[0].startswith('/'):
# assuming we are looking for a template file to render
template_file = 'lca2011' + args[0]
#print template_file
#return render_mako(template_file)
return render_mako(*args, **kargs)
开发者ID:OdyX,项目名称:zookeepr,代码行数:7,代码来源:base.py
示例7: render
def render(path, controller, **kwargs):
kwargs.setdefault('flash_now', None)
kwargs.setdefault('error_now', None)
return render_mako(os.path.join(controller, path), extra_vars={'webhelpers' : webhelpers,
'h' : helpers,
'config' : config,
'kwargs' : kwargs})
开发者ID:davidben,项目名称:anygit,代码行数:7,代码来源:base.py
示例8: __before__
def __before__(self):
action = self.routingargs.get('action', '')
if action == 'ipn': # nothing else needs to be done for IPN
return
c.title = 'Scorekeeper Registration'
c.stylesheets = ['/css/register.css', '/css/redmond/jquery-ui-1.8.2.custom.css']
c.javascript = ['/js/register.js', '/js/jquery-1.4.2.min.js', '/js/jquery-ui-1.8.2.custom.min.js', '/js/jquery.validate.min.js']
c.tabflags = {}
c.sponsorlink = self.settings.sponsorlink
c.seriesname = self.settings.seriesname
ipsession = session.setdefault(self.srcip, {})
if self.database is not None:
self.user = ipsession.setdefault(self.database, {})
c.driverid = self.user.get('driverid', 0)
c.firstname = self.user.get('firstname', '')
c.lastname = self.user.get('lastname', '')
c.previouserror = self.user.get('previouserror', '')
self.user['previouserror'] = ''
if action in ['index', 'events', 'cars', 'profile'] and c.driverid < 1:
session.save()
redirect(url_for(action='login'))
if action not in ['view'] and self.settings.locked:
# Delete any saved session data for this person
del ipsession[self.database]
session.save()
raise BeforePage(render_mako('/register/locked.mako'))
c.events = self.session.query(Event).all()
c.cars = self.session.query(Car).filter(Car.driverid==c.driverid).order_by(Car.classcode,Car.number).all()
session.save()
开发者ID:adrianpike,项目名称:wwscc,代码行数:35,代码来源:register.py
示例9: render
def render(template_name, **kwargs):
"""Render override that add's babel objects"""
extra_vars = kwargs.pop('extra_vars', {})
c = pylons.tmpl_context._current_obj()
extra_vars['format'] = c._format
extra_vars['locale'] = c._locale
extra_vars['timezone'] = c._tzinfo
return render_mako(template_name, extra_vars=extra_vars, **kwargs)
开发者ID:Pylons,项目名称:kai,代码行数:8,代码来源:base.py
示例10: js_playground
def js_playground(self):
from pylons import request
c.sessid = request.session.id
try:
return render_mako("js_playground.mako")
finally:
session.save()
开发者ID:schiermike,项目名称:pylons-websockets,代码行数:8,代码来源:home.py
示例11: challenge
def challenge(self):
challengeid = int(request.GET.get('id', 1))
c.challenge = self.session.query(Challenge).get(challengeid)
c.rounds = dict()
for rnd in self.session.query(ChallengeRound).filter(ChallengeRound.challengeid == challengeid).all():
c.rounds[rnd.round] = rnd
loadChallengeResults(self.session, c.challenge.id, c.rounds)
return render_mako('/challenge/challengereport.mako')
开发者ID:dpodhola,项目名称:wwscc,代码行数:8,代码来源:results.py
示例12: bracket
def bracket(self):
c.javascript.append('/js/jquery-1.4.2.min.js');
challenge = self.session.query(Challenge).get(int(request.GET.get('id', 0)))
b = Bracket(challenge.depth) # Just getting the coords, no drawing takes place
b.getImage()
c.coords = b.getCoords()
c.cid = challenge.id
return render_mako('/challenge/bracketbase.mako')
开发者ID:dpodhola,项目名称:wwscc,代码行数:8,代码来源:results.py
示例13: editor
def editor(self):
if "name" not in request.GET:
return "Missing name"
c.name = request.GET["name"]
c.data = ""
data = self.session.query(Data).get(c.name)
if data is not None:
c.data = data.data
return render_mako("/admin/editor.mako")
开发者ID:adrianpike,项目名称:wwscc,代码行数:9,代码来源:admin.py
示例14: document_preview
def document_preview(target_url):
key = "rca.1.1.20140729T133847Z.c5e76a9d7bb0d277.20ab36596feb419a8283b4a21557d53414834752"
request_url = "http://rca.yandex.com/?key=%s&url=%s" % (key, target_url)
resp = urllib2.urlopen(request_url).read()
json_decoder = json.JSONDecoder()
result = json_decoder.decode(resp)
if result:
c.json = result
return render_mako("page_preview.mako")
return ""
开发者ID:redvel2,项目名称:simple_pylon_chat,代码行数:10,代码来源:funcs.py
示例15: getitems
def getitems(self):
c.items = list()
for id in map(int, request.GET.get('driverids', "").split(',')):
dr = self.session.query(Driver).filter(Driver.id==id).first();
cars = self.session.query(Car).filter(Car.driverid==id).all();
for car in cars:
car.runs = len(self.session.query(Run.eventid).distinct().filter(Run.carid==car.id).filter(Run.eventid<100).all())
c.items.append(self.DriverInfo(dr, cars))
return {'data': str(render_mako('/admin/driverinfo.mako'))}
开发者ID:adrianpike,项目名称:wwscc,代码行数:10,代码来源:entranteditor.py
示例16: processPurge
def processPurge(self):
try:
import sqlite3
except:
from pysqlite2 import dbapi2 as sqlite3
searchseries = list()
purgeclasses = list()
for k in request.POST.keys():
if k[0:2] == "c-":
purgeclasses.append(k[2:])
elif k[0:2] == "s-":
searchseries.append(k[2:])
# All cars that have runs in any previous database
carids = set()
for s in searchseries:
conn = sqlite3.connect(os.path.join(config["seriesdir"], s))
conn.row_factory = sqlite3.Row
cur = conn.cursor()
cur.execute("select distinct carid from runs")
carids.update([x[0] for x in cur.fetchall()])
conn.close()
# All drivers associated with those runs
driverids = set()
for s in searchseries:
conn = sqlite3.connect(os.path.join(config["seriesdir"], s))
conn.row_factory = sqlite3.Row
cur = conn.cursor()
cur.execute("select distinct driverid from cars where id in (%s)" % (",".join(map(str, carids))))
driverids.update([x[0] for x in cur.fetchall()])
conn.close()
# Drivers in this database that have no unique/email
# blankdr = [x[0] for x in self.session.execute("select id from drivers where email=''")]
delcar = deldr = 0
if len(searchseries) > 0: # don't delete if they didn't select any series, that will delete all
delcar = self.session.execute(
"delete from cars where id not in (%s)" % (",".join(map(str, carids)))
).rowcount
# delcar += self.session.execute("delete from cars where driverid in (%s)" % ','.join(map(str,blankdr))).rowcount
deldr = self.session.execute(
"delete from drivers where id not in (%s)" % (",".join(map(str, driverids)))
).rowcount
# deldr += self.session.execute("delete from drivers where id in (%s)" % ','.join(map(str,blankdr))).rowcount
if len(purgeclasses) > 0:
sqllist = "', '".join(purgeclasses)
delcar += self.session.execute("delete from cars where classcode in ('" + sqllist + "')").rowcount
self.session.commit()
c.text = "<h4>Deleted %s cars and %s drivers</h4>" % (delcar, deldr)
return render_mako("/admin/simple.mako")
开发者ID:adrianpike,项目名称:wwscc,代码行数:55,代码来源:admin.py
示例17: cars
def cars(self):
c.classdata = ClassData(self.session)
c.inuse = []
c.notinuse = []
regids = [x[0] for x in self.session.query(Registration.carid).join('car').distinct().filter(Car.driverid==c.driverid)]
for car in c.cars:
if car.id in regids:
c.inuse.append(car)
else:
c.notinuse.append(car)
return render_mako('/register/cars.mako')
开发者ID:adrianpike,项目名称:wwscc,代码行数:11,代码来源:register.py
注:本文中的pylons.templating.render_mako函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论