本文整理汇总了Python中spline.lib.base.render函数的典型用法代码示例。如果您正苦于以下问题:Python render函数的具体用法?Python render怎么用?Python render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了render函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: profile_edit_commit
def profile_edit_commit(self, id, name=None):
"""Save profile changes."""
c.page_user = meta.Session.query(users_model.User).get(id)
if not c.page_user:
abort(404)
# XXX could use some real permissions
if c.page_user != c.user:
abort(403)
c.form = ProfileEditForm(request.params,
name=c.page_user.name,
)
if not c.form.validate():
return render('/users/profile_edit.mako')
c.page_user.name = c.form.name.data
meta.Session.add(c.page_user)
meta.Session.commit()
h.flash('Saved your profile.', icon='tick')
redirect(
url(controller='users', action='profile',
id=c.page_user.id, name=c.page_user.name),
code=303,
)
开发者ID:encukou,项目名称:spline,代码行数:30,代码来源:users.py
示例2: threads
def threads(self, forum_id):
c.forum = meta.Session.query(forum_model.Forum).get(forum_id)
if not c.forum:
abort(404)
c.write_thread_form = WriteThreadForm()
# nb: This will never show post-less threads. Oh well!
last_post = aliased(forum_model.Post)
threads_q = c.forum.threads \
.join((last_post, forum_model.Thread.last_post)) \
.order_by(last_post.posted_time.desc()) \
.options(
contains_eager(forum_model.Thread.last_post, alias=last_post),
joinedload('last_post.author'),
)
c.num_threads = threads_q.count()
try:
c.skip = int(request.params.get('skip', 0))
except ValueError:
abort(404)
c.per_page = 89
c.threads = threads_q.offset(c.skip).limit(c.per_page)
return render('/forum/threads.mako')
开发者ID:encukou,项目名称:spline,代码行数:25,代码来源:forum.py
示例3: skills_list
def skills_list(self):
skills = (db.pokedex_session.query(t.ConquestWarriorSkill)
.join(t.ConquestWarriorSkill.names_local)
.order_by(t.ConquestWarriorSkill.names_table.name.asc()))
# We want to split the list up between generic skills anyone can get
# and the unique skills a specific warlord gets at a specific rank.
# The two player characters throw a wrench in that though so we just
# assume any skill known only by warlords is unique, which happens to
# work.
warriors_and_ranks = sqla.orm.join(t.ConquestWarrior,
t.ConquestWarriorRank)
generic_clause = (sqla.sql.exists(warriors_and_ranks.select())
.where(sqla.and_(
t.ConquestWarrior.archetype_id != None,
t.ConquestWarriorRank.skill_id ==
t.ConquestWarriorSkill.id))
)
c.generic_skills = skills.filter(generic_clause).all()
c.unique_skills = (skills.filter(~generic_clause)
.options(
sqla.orm.joinedload('warrior_ranks'),
sqla.orm.joinedload('warrior_ranks.warrior')
)
.all())
# Decide randomly which player gets displayed
c.player_index = randint(0, 1)
return render('/pokedex/conquest/skill_list.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:33,代码来源:pokedex_conquest.py
示例4: whos_that_pokemon
def whos_that_pokemon(self):
u"""A silly game that asks you to identify Pokémon by silhouette, cry,
et al.
"""
c.javascripts.append(('pokedex', 'whos-that-pokemon'))
return render('/pokedex/gadgets/whos_that_pokemon.mako')
开发者ID:encukou,项目名称:spline-pokedex,代码行数:7,代码来源:pokedex_gadgets.py
示例5: permissions
def permissions(self):
if not c.user.can('administrate'):
abort(403)
c.roles = meta.Session.query(users_model.Role) \
.order_by(users_model.Role.id.asc()).all()
return render('/users/admin/permissions.mako')
开发者ID:encukou,项目名称:spline,代码行数:7,代码来源:admin.py
示例6: abilities_list
def abilities_list(self):
c.abilities = (db.pokedex_session.query(t.Ability)
.join(t.Ability.names_local)
.filter(t.Ability.conquest_pokemon.any())
.order_by(t.Ability.names_table.name.asc())
.all()
)
return render('/pokedex/conquest/ability_list.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:9,代码来源:pokedex_conquest.py
示例7: kingdoms_list
def kingdoms_list(self):
c.kingdoms = (db.pokedex_session.query(t.ConquestKingdom)
.options(
sqla.orm.joinedload('type')
)
.order_by(t.ConquestKingdom.id)
.all()
)
return render('/pokedex/conquest/kingdom_list.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:10,代码来源:pokedex_conquest.py
示例8: kingdoms
def kingdoms(self, name):
try:
c.kingdom = db.get_by_name_query(t.ConquestKingdom, name).one()
except NoResultFound:
return self._not_found()
# We have pretty much nothing for kingdoms. Yet.
c.prev_kingdom, c.next_kingdom = self._prev_next_id(
c.kingdom, t.ConquestKingdom, 'id')
return render('/pokedex/conquest/kingdom.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:11,代码来源:pokedex_conquest.py
示例9: profile
def profile(self, id, name=None):
"""Main user profile.
URL is /users/id:name, where 'name' only exists for readability and is
entirely optional and ignored.
"""
c.page_user = meta.Session.query(users_model.User).get(id)
if not c.page_user:
abort(404)
return render('/users/profile.mako')
开发者ID:encukou,项目名称:spline,代码行数:12,代码来源:users.py
示例10: warriors_list
def warriors_list(self):
c.warriors = (db.pokedex_session.query(t.ConquestWarrior)
.options(
sqla.orm.subqueryload('ranks'),
sqla.orm.subqueryload('ranks.stats'),
sqla.orm.subqueryload('types')
)
.order_by(t.ConquestWarrior.id)
.all()
)
return render('/pokedex/conquest/warrior_list.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:12,代码来源:pokedex_conquest.py
示例11: document
def document(self):
"""Render the error document."""
# code and messae might come from GET, *or* from the Pylons response
# object. They seem to come from the latter most of the time, but
# let's be safe anyway.
response = request.environ.get('pylons.original_response')
c.message = request.GET.get('message', response and response.status)
c.code = request.GET.get('code', response and response.status_int)
c.code = int(c.code)
return render('/error.mako')
开发者ID:encukou,项目名称:spline,代码行数:12,代码来源:error.py
示例12: skills
def skills(self, name):
try:
c.skill = (db.get_by_name_query(t.ConquestWarriorSkill, name)
.one())
except NoResultFound:
return self._not_found()
### Prev/next for header
c.prev_skill, c.next_skill = self._prev_next_name(
t.ConquestWarriorSkill, c.skill)
return render('/pokedex/conquest/skill.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:12,代码来源:pokedex_conquest.py
示例13: css
def css(self):
"""Returns all the CSS in every plugin, concatenated."""
# This solution sucks donkey balls, but it's marginally better than
# loading every single stylesheet manually, so it stays until I have
# a better idea
response.headers['Content-type'] = 'text/css; charset=utf-8'
stylesheets = []
for css_file in config['spline.plugins.stylesheets']:
stylesheets.append(render("/css/%s" % css_file))
return '\n'.join(stylesheets)
开发者ID:encukou,项目名称:spline,代码行数:12,代码来源:main.py
示例14: list
def list(self):
u"""Show a list of all Pokémon currently uploaded to the GTS."""
gts_pokemons = meta.Session.query(gts_model.GTSPokemon).all()
c.savefiles = []
for gts_pokemon in gts_pokemons:
savefile = SaveFilePokemon(gts_pokemon.pokemon_blob)
savefile.use_database_session(db.pokedex_session)
c.savefiles.append(savefile)
return render('/gts/list.mako')
开发者ID:Epithumia,项目名称:spline-pokedex,代码行数:12,代码来源:gts_browse.py
示例15: write_thread
def write_thread(self, forum_id):
"""Provides a form for posting a new thread."""
if not c.user.can('forum:create-thread'):
abort(403)
try:
c.forum = meta.Session.query(forum_model.Forum) \
.filter_by(id=forum_id).one()
except NoResultFound:
abort(404)
c.write_thread_form = WriteThreadForm(request.params)
return render('/forum/write_thread.mako')
开发者ID:encukou,项目名称:spline,代码行数:13,代码来源:forum.py
示例16: moves_list
def moves_list(self):
c.moves = (db.pokedex_session.query(t.Move)
.filter(t.Move.conquest_data.has())
.options(
sqla.orm.joinedload('conquest_data'),
sqla.orm.joinedload('conquest_data.move_displacement'),
)
.join(t.Move.names_local)
.order_by(t.Move.names_table.name.asc())
.all()
)
return render('/pokedex/conquest/move_list.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:13,代码来源:pokedex_conquest.py
示例17: write
def write(self, forum_id, thread_id):
"""Provides a form for posting to a thread."""
if not c.user.can('forum:create-post'):
abort(403)
try:
c.thread = meta.Session.query(forum_model.Thread) \
.filter_by(id=thread_id, forum_id=forum_id).one()
except NoResultFound:
abort(404)
c.write_post_form = WritePostForm(request.params)
return render('/forum/write.mako')
开发者ID:encukou,项目名称:spline,代码行数:13,代码来源:forum.py
示例18: pokemon_list
def pokemon_list(self):
c.pokemon = (db.pokedex_session.query(t.PokemonSpecies)
.filter(t.PokemonSpecies.conquest_order != None)
.options(
sqla.orm.subqueryload('conquest_abilities'),
sqla.orm.joinedload('conquest_move'),
sqla.orm.subqueryload('conquest_stats'),
sqla.orm.subqueryload('default_pokemon.types')
)
.order_by(t.PokemonSpecies.conquest_order)
.all()
)
return render('/pokedex/conquest/pokemon_list.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:14,代码来源:pokedex_conquest.py
示例19: abilities
def abilities(self, name):
try:
c.ability = db.get_by_name_query(t.Ability, name).one()
except NoResultFound:
return self._not_found()
# XXX The ability might exist, but not in Conquest
if not c.ability.conquest_pokemon:
return self._not_found()
c.prev_ability, c.next_ability = self._prev_next_name(
t.Ability, c.ability,
filters=[t.Ability.conquest_pokemon.any()])
return render('/pokedex/conquest/ability.mako')
开发者ID:veekun,项目名称:spline-pokedex,代码行数:15,代码来源:pokedex_conquest.py
示例20: profile_edit
def profile_edit(self, id, name=None):
"""Main user profile editing."""
c.page_user = meta.Session.query(users_model.User).get(id)
if not c.page_user:
abort(404)
# XXX could use some real permissions
if c.page_user != c.user:
abort(403)
c.form = ProfileEditForm(request.params,
name=c.page_user.name,
)
return render('/users/profile_edit.mako')
开发者ID:encukou,项目名称:spline,代码行数:15,代码来源:users.py
注:本文中的spline.lib.base.render函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论