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

Python base.render函数代码示例

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

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



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

示例1: publish

    def publish(self, domain='yourdomainhere'):
        c.title = "Nodetraq -- DNS - Publish"
        c.selected_page = "dns"
        c.subpage = "publish"
        c.domain = domain

        prod = NodetraqCotendo()
        prod.GrabDNS(domain, 1)
        staging = NodetraqCotendo()
        staging.GrabDNS(domain, 1)

        results = ch.get_view('dns', 'configs')
        for r in results.rows:
            if r.value['environment'] == 'staging':
                staging.ImportDNS(r.value["config"], r.value["token"])
                break

        staging_config = staging.dns.config.splitlines(1)
        prod_config = prod.dns.config.splitlines(1)

        diff = ''.join(difflib.unified_diff(
                prod_config, staging_config, 'production', 'staging'))

        c.diff = diff
        return render('/dns/publish.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:25,代码来源:dns.py


示例2: index

    def index(self, domain='yourdomainhere'):
        c.title = "Nodetraq -- DNS"
        c.selected_page = "dns"
        c.subpage = "list"
        c.domain = domain

        cotendo = NodetraqCotendo()
        cotendo.GrabDNS(domain, 1)
        ch.select("nodetraq")

        # Sync views
        ch.sync_view('nodetraq/model/views')

        # Update CouchDB to have a copy of the latest dns entries.
        results = ch.get_view('dns', 'configs')
        doc = None
        for r in results.rows:
            if r.value['environment'] == 'staging':
                doc = couchdb.Document(r.value)
                cotendo.ImportDNS(r.value["config"], r.value['token'])
            if doc:
                if doc["config"] != cotendo.dns.config:
                    doc["config"] = cotendo.dns.config
                    doc["token"] = cotendo.dns.token
                    ch.save(doc)
        if not doc:
            doc = couchdb.Document({"doc_type": "dns",
                     "domain": domain,
                     "environment": "staging",
                     "token": cotendo.dns.token,
                     "config": cotendo.dns.config })
            ch.save(doc)

        c.records = cotendo.dns._entries
        return render('dns/list.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:35,代码来源:dns.py


示例3: index

    def index(self):
        c.title = 'Nodetraq -- Graphs'
        c.selected_page = 'graphs'
        c.subpage = 'index'

        c.graphs = Session.query(Graph).all()
        return render('/graphs/index.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:7,代码来源:graphs.py


示例4: index

    def index(self):
        c.page = int(request.params['page'])\
                if 'page' in request.params else 1
        c.title = 'Nodetraq - Groups'
        c.selected_page = 'groups'
        c.subpage = 'list'
        c.heading = "Groups"
        c.filters = [
                { 'name': 'group', 'label': 'Group', 'type': 'text' }
            ]
        query, c.search_fields = get_fields_and_query(Session,
                Group, request.params)
        c.request_url = request.environ.get('PATH_INFO')
        if request.environ.get('QUERY_STRING'):
            c.request_url += '?' + request.environ['QUERY_STRING']
        c.group_count = query.count()

        c.link_append = '&' + urlencode(\
                [p for p in request.params.items()\
                    if p[0] != 'page'])
        if c.link_append == '&':
            c.link_append = None

        if 'show_all' in request.params:
            c.total_pages = 1
            c.current_page_count = 1
            c.groups = query.order_by('name').all()
        else:
            c.total_pages = (c.group_count+25-1)/25
            c.current_page_count = (c.page-1)*25
            c.groups = query.order_by('name')\
                    [c.current_page_count: c.current_page_count+25]

        c.all_groups, c.tag_sizes = self.get_tag_info()
        return render('/groups/list.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:35,代码来源:groups.py


示例5: index

    def index(self):
        c.title = 'Nodetraq - LoadBalancer'
        c.selected_page = 'loadbalancer'
        c.subpage = 'index'
        lb = LoadBalancer(ip='lb_iphere')
        pools = lb.get_pools()
        pools.sort()
        c.pool_count = len(pools)

        c.link_append = '&' + urlencode(
            [p for p in request.params.items()\
                 if p[0] != 'page'])
        if c.link_append == '&':
            c.link_append = None

        if 'show_all' in request.params:
            c.page = 1
            c.total_pages = 1
            c.current_page_count = 1
            c.members = self.get_members_status(Session, pools)
        else:
            c.page = int(request.params['page'])\
                    if 'page' in request.params else 1
            c.total_pages = (c.pool_count+25-1)/25
            c.current_page_count = (c.page-1)*25
            c.members = self.get_members_status(Session,
                    pools[c.current_page_count:c.current_page_count+25])

        return render('/loadbalancer/index.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:29,代码来源:loadbalancer.py


示例6: edit_studio

 def edit_studio(self, id):
     c.studio = Session.query(Studio).filter(Studio.id == id).first()
     c.title = "Nodetraq -- Edit Studio"
     c.header = c.studio.name
     c.selected_page = "nodes"
     c.subpage = "edit_studio"
     return render('/nodes/studios/edit.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:7,代码来源:nodes.py


示例7: show_dbbackups

    def show_dbbackups(self):
        c.title = "Nodetraq -- Show Database Backups"
        c.selected_page = "nodes"
        c.subpage = "database"
        sort = None

        c.dbbackups = Session.query(NodeDatabaseBackup).all()
        if not 'sort' in request.params:
            sort = 'server'
        else:
            sort = request.params['sort']

        if sort == 'server':
            c.dbbackups = sorted(
                c.dbbackups, key=lambda backup: backup.server.hostname)
        elif sort == 'storage':
            c.dbbackups = sorted(
                c.dbbackups, key=lambda backup: backup.storage.hostname)
        elif sort == 'directory':
            c.dbbackups = sorted(
                c.dbbackups, key=lambda backup: backup.directory)
        elif sort == 'enabled':
            c.dbbackups = sorted(
                c.dbbackups, key=lambda backup: backup.enabled)

        c.sort = sort

        return render('/nodes/show_dbbackups.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:28,代码来源:nodes.py


示例8: show_game

    def show_game(self, id):
        c.game = Session.query(Game).filter(Game.id == id).first()
        c.title = "Nodetraq -- Game: %s" % c.game.name
        c.header = c.game.name
        c.selected_page = "nodes"
        c.subpage = "show_game"

        c.groups = [
            {'name': 'PE-1950', 'nodes': []},
            {'name': 'PE-2950', 'nodes': []},
            {'name': 'PE-R410', 'nodes': []},
            {'name': 'PE-R610', 'nodes': []},
            {'name': 'PE-R710', 'nodes': []},
            {'name': 'vm', 'nodes': []},
            {'name': 'unknown', 'nodes': []}
            ]

        group_list = lambda groups: [g.name for g in groups]
        for node in c.game.nodes:
            grouped = False
            for group in c.groups:
                if group['name'] in group_list(node.groups):
                    group['nodes'].append(node)
                    grouped = True

            if not grouped:
                c.groups[len(c.groups)-1]['nodes'].append(node)

        return render('/nodes/games/show.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:29,代码来源:nodes.py


示例9: rrd_file

    def rrd_file(self, id):
        response.content_type = 'text/plain'

        if id.isdigit():
            graph_data = Session.query(Graph)\
                .filter(Graph.id == int(id)).first()
        else:
            graph_data = Session.query(Graph)\
                .filter(Graph.name == id).first()

        c.graph = graph_data.filename[1:]
        hostnames = [n.hostname for n in graph_data.get_hosts()]

        c.datasource = generate_rrd_sequence_map(
            hostnames, graph_data.get_rrds())

        c.title = graph_data.name

        if len(c.datasource) == 2:
            c.colors = ['Lime', 'Red']
            c.brmod = 2
        else:
            c.colors = ['Lime', 'Teal', 'Maroon']
            c.brmod = 3

        return render('/graphs/graph.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:26,代码来源:graphs.py


示例10: add_record

    def add_record(self, domain='yourdomainhere'):
        c.title = "Nodetraq -- DNS - Add Record"
        c.selected_page = "dns"
        c.subpage = "add_record"
        c.domain = domain

        return render('dns/add_record.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:7,代码来源:dns.py


示例11: add

    def add(self):
        c.group = Session.query(Group).filter(Group.id == id).first()
        c.title = 'Nodetraq - Group - Add'
        c.selected_page = 'groups'
        c.subpage = 'add'

        return render('/groups/add.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:7,代码来源:groups.py


示例12: show

 def show(self, pool):
     c.title = 'Nodetraq - Loadbalancer - Show'
     c.selected_page = 'loadbalancer'
     c.subpage = 'show'
     lb = LoadBalancer(ip='your_lb_ip')
     c.members = self.get_members_status(Session, [pool])[0]
     return render('/loadbalancer/show.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:7,代码来源:loadbalancer.py


示例13: index

    def index(self):
        c.title = 'Nodetraq - Network'
        c.selected_page = 'network'
        c.subpage = 'index'

        c.network_devices = Session.query(NetworkDevice).all()
        return render('/network/index.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:7,代码来源:network.py


示例14: edit_record

    def edit_record(self, domain='yourdomainhere', type=None, host=''):
        c.title = "Nodetraq -- DNS - Edit Record"
        c.selected_page = "dns"
        c.subpage = "edit_record"
        c.domain = domain

        cotendo = NodetraqCotendo()
        cotendo.GrabDNS(domain, 1)
        # check if record exists, if it does, update it otherwise
        results = ch.get_view('dns', 'configs')
        doc = None
        for r in results.rows:
            if r.value['environment'] == 'staging':
                cotendo.ImportDNS(r.value["config"], r.value['token'])
                doc = couchdb.Document(r.value)
                break

        c.record = cotendo.dns.get_record(type, host)
        if not c.record:
            session['flash'] = "Not a valid record"
            session.save()
            return redirect(url(controller="dns",
                                action="index", domain=domain))

        return render('/dns/edit_record.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:25,代码来源:dns.py


示例15: namelist

 def namelist(self, format='mako'):
     c.nodes = Session.query(Node.hostname).all()
     if format == 'json':
         response.content_type = 'application/json'
     elif format == 'xml':
         response.content_type = 'application/xml'
     return render('/nodes/namelist/list.' + format)
开发者ID:seryl,项目名称:Nodetraq,代码行数:7,代码来源:nodes.py


示例16: index

    def index(self):
        c.title = 'Nodetraq - Dashboard'
        c.selected_page = 'dashboard'
        c.subpage = 'index'

        c.sync_issues = self.get_sync_issues()['issues']
        return render('/dashboard/index.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:7,代码来源:dashboard.py


示例17: info

    def info(self, id):
        c.title = "Nodetraq - Activity - Info"
        c.selected_page = "activity"
        c.subpage = "info"

        c.activity = Session.query(Activity).filter(Activity.id == id).first()
        c.Session = Session
        return render("/activity/info.mako")
开发者ID:seryl,项目名称:Nodetraq,代码行数:8,代码来源:activity.py


示例18: show

 def show(self, id, vhostid=None):
     c.title = 'Nodetraq - Vhost - Edit'
     c.selected_page = 'nodes'
     c.subpage = 'vhost'
     c.header = 'Show Vhost'
     c.vhostid = vhostid
     c.node_id = id
     return render('/nodes/vhosts/show.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:8,代码来源:vhosts.py


示例19: new

    def new(self, id):
        c.title = 'Nodetraq - vhosts'
        c.selected_page = 'nodes'
        c.subpage = 'vhosts'
        c.header = 'Nodes:vhosts'
        c.node_id = id

        return render('/nodes/vhosts/new.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:8,代码来源:vhosts.py


示例20: show

    def show(self, id):
        c.title = 'Nodetraq - Network Devices'
        c.selected_page = 'network'
        c.subpage = 'show'

        c.network_device = Session.query(NetworkDevice).filter(
            id == NetworkDevice.id).first()
        return render('/network/show.mako')
开发者ID:seryl,项目名称:Nodetraq,代码行数:8,代码来源:network.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python meta.Session类代码示例发布时间:2022-05-27
下一篇:
Python models.Node类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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