当前位置: 首页>>代码示例>>Python>>正文


Python base.render函数代码示例

本文整理汇总了Python中spline.lib.base.render函数的典型用法代码示例。如果您正苦于以下问题:Python render函数的具体用法?Python render怎么用?Python render使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了render函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的spline.lib.base.render函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。