• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python web.render函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GET

 def GET(self):
     user_stats = UserStats(count=10).get()
     
     week_ago = datetime.now() - timedelta(days=7)
     unix_week = int(mktime(week_ago.timetuple()))
     story_stats = StoryStats(time_offset = unix_week, count=15).get()
     web.render('stats.tpl.html', {'user_stats': user_stats, 'story_stats': story_stats})
开发者ID:AlexKordic,项目名称:sandbox,代码行数:7,代码来源:redditriver.py


示例2: GET

 def GET(self,nid):
     page = self.page
     node = mod.node.load(nid)
     if node is None:
         pagenotfound()
     else:
         links = ''
         page.title = node.title
         
         #controls are for the edit/delete/revisions/etc links for a node
         #is there a better place to do this than here?
         controls = []
         if hasaccess(self.page.user, ''.join(('edit ', node.type, ' content'))) \
             or (hasaccess(page.user, ''.join(('edit own ', node.type, ' content'))) \
             and page.user.uid == node.uid):
             controls.append( (''.join(('/node/', str(node.nid), '/edit')),'edit') )
         if hasaccess(self.page.user, ''.join(('delete ', node.type, ' content'))) \
             or (hasaccess(page.user, ''.join(('delete own ', node.type, ' content'))) \
             and page.user.uid == node.uid):
             controls.append( (''.join(('/node/', str(node.nid), '/delete')),'delete') )
         controls = web.render('node_controls.html', asTemplate=True)
         
         try:
             web.render(''.join(('node-',node.type,'.html')))
         except:
             web.render('node.html')
开发者ID:keizo,项目名称:kulu,代码行数:26,代码来源:node.py


示例3: GET

    def GET(self, cur_page=1,):
        i = web.input()

        try:
            cur_page = int(cur_page) or 1
        except:
            cur_page = 1

        domainLib = domainlib.Domain()
        result = domainLib.listAccounts(cur_page=cur_page)

        if result[0] is True:
            allDomains = result[2]

            return web.render(
                'pgsql/domain/list.html',
                cur_page=cur_page,
                total=result[1],
                allDomains=allDomains,
                msg=i.get('msg', None),
            )
        else:
            return web.render(
                'pgsql/domain/list.html',
                cur_page=cur_page,
                total=0,
                allDomains=[],
                msg=result[1],
            )
开发者ID:CBEPX,项目名称:iredadmin,代码行数:29,代码来源:domain.py


示例4: GET

 def GET(self):
     page = self.page
     
     table = inc.tablesort.table()
     
     table.header.titles = ['Type',  'Date',         'Message',  'User', 'Operation']
     table.header.fields = ['type',  'timestamp',    'message',  'name']
     table.header.sorts   = ['asc',   'desc',         'asc',      'asc']
     table.default_order_by = 'timestamp'
     
     sql = '''SELECT w.wid, \
     w.uid, w.severity, w.type, w.timestamp, w.message, w.link, \
     u.name FROM watchdog w INNER JOIN users u \
     ON w.uid = u.uid'''+table.order_sql()
     
     iter_entries, page_nums = inc.pager.query(sql, limit=100)
     
     #TODO: i don't quite understand why this line is needed,
     # but i do know things stop working without it
     table.rows = [] 
     for entry in iter_entries:
         table.rows.append( (str(entry.type),
                       str(inc.common.format_date(entry.timestamp)),
                       str(entry.message),
                       str(entry.name),
                       'put operation here') )
     
     content = sql
     
     content += table.render()
            
     content += page_nums.render()
     web.render('generic.html')
开发者ID:keizo,项目名称:kulu,代码行数:33,代码来源:watchdog.py


示例5: POST

    def POST(self, node_type):
        page = self.page
        form = _form_node(node_type, 
                page.user.roles.keys())  # checks if this node_type exists too
        checkaccess(page.user, ''.join(('create ',node_type,' content')))
        
        if form.validates():
            node = form.d
            node.time_now = int(time.time())
            node.uid = page.user.uid
            
            # Get publishing settings.
            options = mod[node_type].defaults
            
            # Insert main entry in 'node' table
            node.nid = web.insert('node',uid=page.user.uid,created=node.time_now,
                             changed=node.time_now, title=node.title, type=node_type,
                             **options)
                             
            # Do module specific insertions.
            if hasattr(mod[node_type], 'node_insert'):
                mod[node_type].node_insert(node)

            web.redirect('/node/'+str(node.nid))
            
        content = '<form method="post" name="new_node">'
        content += form.render()
        content += '<input type="submit" /></form>'
        web.render('generic.html')
开发者ID:keizo,项目名称:kulu,代码行数:29,代码来源:node.py


示例6: POST

 def POST(self):
     page = self.page
     i = web.input()
     captcha = recaptcha.submit(i.recaptcha_challenge_field, 
                                 i.recaptcha_response_field, 
                                 private_key, web.ctx.ip)
     content = captcha.is_valid, captcha.error_code
     web.render('generic.html')
开发者ID:keizo,项目名称:kulu,代码行数:8,代码来源:test.py


示例7: GET

 def GET(self):
     path = web.ctx.path
     variable = glbl.variable
     user = web.storage({'uid':0})
     limit = int(variable['default_nodes_main'])
     nodes = mod.node.node_load_many(limit)
     content = mod.node.node_render_many(nodes)
     web.render('index.html')
开发者ID:keizo,项目名称:kulu,代码行数:8,代码来源:link.py


示例8: GET

 def GET(self):
     page = self.page
     form = form_edit_filters()
     content = 'filters available:'+str(_filters_available())
     content += '<form method="post">'
     content += form.render()
     content += '<input type="submit" /></form>'
     web.render('generic.html')
开发者ID:keizo,项目名称:kulu,代码行数:8,代码来源:filter.py


示例9: GET

    def GET(self, profile_type, mail):
        self.mail = web.safestr(mail)
        self.profile_type = web.safestr(profile_type)

        if session.get('domainGlobalAdmin') is not True and session.get('username') != self.mail:
            # Don't allow to view/update other admins' profile.
            raise web.seeother('/profile/admin/general/%s?msg=PERMISSION_DENIED' % session.get('username'))

        # Get admin profile.
        adminLib = admin.Admin()
        result = adminLib.profile(self.mail)
        if result[0] is not True:
            raise web.seeother('/admins?msg=' + result[1])
        else:
            self.admin_profile = result[1]

        i = web.input()

        if self.profile_type == 'general':
            # Get available languages.
            if result[0] is True:
                ###################
                # Managed domains
                #

                # Check permission.
                #if session.get('domainGlobalAdmin') is not True:
                #    raise web.seeother('/profile/admin/general/%s?msg=PERMISSION_DENIED' % self.mail)

                # Get all domains.
                domainLib = domainlib.Domain()
                resultOfAllDomains = domainLib.listAccounts(attrs=['domainName', 'cn', ])
                if resultOfAllDomains[0] is True:
                    self.allDomains = resultOfAllDomains[1]
                else:
                    return resultOfAllDomains

                return web.render(
                    'ldap/admin/profile.html',
                    mail=self.mail,
                    profile_type=self.profile_type,
                    profile=self.admin_profile,
                    languagemaps=languages.get_language_maps(),
                    allDomains=self.allDomains,
                    msg=i.get('msg', None),
                )
            else:
                raise web.seeother('/profile/admin/%s/%s?msg=%s' % (self.profile_type, self.mail, result[1]))

        elif self.profile_type == 'password':
            return web.render('ldap/admin/profile.html',
                              mail=self.mail,
                              profile_type=self.profile_type,
                              profile=self.admin_profile,
                              min_passwd_length=settings.min_passwd_length,
                              max_passwd_length=settings.max_passwd_length,
                              msg=i.get('msg', None),
                             )
开发者ID:CBEPX,项目名称:iredadmin,代码行数:58,代码来源:admin.py


示例10: render_many

def render_many(nodes):
    """Returns a string containing the templated output of node teasers."""
    t = []
    for node in nodes:
        try:
            t.append(str(web.render(''.join(('node-',node.type,'_teaser.html')), asTemplate=True)))
        except:
            t.append(str(web.render('node_teaser.html', asTemplate=True)))
    return ''.join(t)
开发者ID:keizo,项目名称:kulu,代码行数:9,代码来源:node.py


示例11: GET

 def GET(self, tag):
     bookmarks = []
     bs = list(web.select("bookmarks", order="created desc"))
     for b in bs:
         b.tags = b.tags.split()
         if tag in b.tags:
             bookmarks.append(b)
     empty = (len(bookmarks) == 0)
     web.render('search.html')
开发者ID:aviatorBeijing,项目名称:ptpy,代码行数:9,代码来源:lecker.py


示例12: GET

	def GET(self):
		web.header('Content-Type', 'text/html')
		query = web.input().get('q')
		start = time.time()
		i = dolphy.Index('data/test.db')
		results = i.search(query, 'simple')
		duration = "%.6f" % (time.time() - start)
		tmp = open('templates/results.html').read()
		web.render(tmp, isString=True)
开发者ID:tomdyson,项目名称:dolphy,代码行数:9,代码来源:web-dolphy.py


示例13: GET

 def GET(self):
     page = self.page
     form = form_variable()
     form_new = form_new_variable()
     content = '<form method="post" name="settings">'
     content += form_new.render()
     content += form.render()
     content += '<input type="submit" /></form>'
     web.render('generic.html')
开发者ID:keizo,项目名称:kulu,代码行数:9,代码来源:admin.py


示例14: GET

 def GET(self):
     page = self.page
     f = form_util()
     content = '<form method="post">'
     content += f.render()
     content += '<input type="submit" /></form>'
     var = str(glbl.filter)
     var = var.replace('<', '&lt;')
     content += var
     web.render('generic.html')
开发者ID:keizo,项目名称:kulu,代码行数:10,代码来源:test.py


示例15: POST

 def POST(self):
     page = self.page
     form = form_login()
     if form.validates():
         # successful login info
         data = form.d
         login(email=data.email,remember_me=data.remember_me)
         web.redirect('/user')
     else:
         web.render('login.html')
开发者ID:keizo,项目名称:kulu,代码行数:10,代码来源:user.py


示例16: pagenotfound

def pagenotfound():
    """the parameter page is self.page from the calling class"""
    page = web.storage()
    page.path = web.ctx.path
    page.variable = glbl.variable
    page.title = ''
    page.message = ''
    page.user = inc.session.read()
    inc.session.write(page.user.sid,'',user=page.user)
    web.render('pagenotfound.html')
开发者ID:keizo,项目名称:kulu,代码行数:10,代码来源:drupy.py


示例17: POST

 def POST(self, tag):
     i = web.input()
     tags = i.tags.split()
     bookmarks = []
     bs = list(web.select("bookmarks", order="created desc"))
     for b in bs:
         b.tags = b.tags.split()
         if every(lambda t: t in b.tags, tags):
             bookmarks.append(b)
     empty = (len(bookmarks) == 0)
     web.render('search.html')
开发者ID:aviatorBeijing,项目名称:ptpy,代码行数:11,代码来源:lecker.py


示例18: GET

    def GET(self, cur_page=1):
        i = web.input()
        cur_page = int(cur_page)

        if cur_page == 0:
            cur_page == 1

        adminLib = admin.Admin()
        result = adminLib.listAccounts()

        connutils = connUtils.Utils()
        sl = connutils.getSizelimitFromAccountLists(
            result[1],
            curPage=cur_page,
            sizelimit=session['pageSizeLimit'],
        )

        if cur_page > sl.get('totalPages', 0):
            cur_page = sl.get('totalPages', 0)

        return web.render(
            'ldap/admin/list.html',
            cur_page=cur_page,
            total=sl.get('totalAccounts'),
            admins=sl.get('accountList'),
            msg=i.get('msg', None),
        )
开发者ID:FlorianHeigl,项目名称:iredmail.iredadmin,代码行数:27,代码来源:admin.py


示例19: GET

    def GET(self, profile_type, domain):
        i = web.input()
        self.domain = web.safestr(domain.split('/', 1)[0])
        self.profile_type = web.safestr(profile_type)

        if not iredutils.isDomain(self.domain):
            return web.seeother('/domains?msg=EMPTY_DOMAIN')

        domainLib = domainlib.Domain()
        result = domainLib.profile(domain=self.domain)

        if result[0] is True:
            r = domainLib.listAccounts(attrs=['domainName'])
            if r[0] is True:
                allDomains = r[1]
            else:
                return r

            allAccountSettings = ldaputils.getAccountSettingFromLdapQueryResult(result[1], key='domainName',)

            return web.render(
                'ldap/domain/profile.html',
                cur_domain=self.domain,
                allDomains=allDomains,
                allAccountSettings=allAccountSettings,
                profile=result[1],
                profile_type=self.profile_type,
                msg=i.get('msg', None),
            )
        else:
            return web.seeother('/domains?msg=' + result[1])
开发者ID:FlorianHeigl,项目名称:iredmail.iredadmin,代码行数:31,代码来源:domain.py


示例20: GET

    def GET(self, profile_type, mail):
        i = web.input()
        self.mail = str(mail).lower()
        self.cur_domain = self.mail.split('@', 1)[-1]
        self.profile_type = str(profile_type)

        if self.mail.startswith('@') and iredutils.is_domain(self.cur_domain):
            # Catchall account.
            raise web.seeother('/profile/domain/catchall/%s' % self.cur_domain)

        if not iredutils.is_email(self.mail):
            raise web.seeother('/domains?msg=INVALID_USER')

        if not iredutils.is_domain(self.cur_domain):
            raise web.seeother('/domains?msg=INVALID_DOMAIN_NAME')

        userLib = userlib.User()
        qr = userLib.profile(domain=self.cur_domain, mail=self.mail)
        if qr[0] is True:
            self.profile = qr[1]
        else:
            raise web.seeother('/users/%s?msg=%s' % (self.cur_domain, web.urlquote(qr[1])))

        return web.render(
            'pgsql/user/profile.html',
            cur_domain=self.cur_domain,
            mail=self.mail,
            profile_type=self.profile_type,
            profile=self.profile,
            languagemaps=get_language_maps(),
            msg=i.get('msg'),
        )
开发者ID:CBEPX,项目名称:iredadmin,代码行数:32,代码来源:user.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python web.rstrips函数代码示例发布时间:2022-05-26
下一篇:
Python web.redirect函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap