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

Python template.template函数代码示例

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

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



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

示例1: Entry

def Entry(url):
    if not url in ['', '/']:
        url = config.entry_url + url
        params = entryService.find_by_url(entryService.types.entry, url)
        if params.entry == None:
            return template('error', params=params, config=config)
        else:
            return template('entry', params=params, config=config)
    params = entryService.search(entryService.types.index, url)
    return template('index', params=params, config=config)
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:10,代码来源:routes.py


示例2: Raw

def Raw(url):
    url = config.raw_url + url
    raw = entryService.find_raw(url)
    if not raw == None:
        response.headers['Content-Type'] = 'text/plain'
        response.headers['Content-Encoding'] = 'utf-8'
        return raw.strip()
    params = entryService.archive(entryService.types.raw, url)
    if params.entries  == None:
        return template('error', params=params, config=config)
    return template('archive', params=params, config=config)
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:11,代码来源:routes.py


示例3: Search

def Search(url):
    print url.split("/")
    type,value,startStr,limitStr = url.split("/")
    limit = int(limitStr)
    start = int(startStr)

    url = '%s/?type=%s&value=%s&start=%d&limit=%d' % (config.search_url, type, value, start, limit)
    params = entryService.search(type, url, value, start, limit)
    if not params.entries == None:
        return template('search', params=params, config=config)
    return template('error', params=params, config=config)
开发者ID:zylianyao,项目名称:YouMd,代码行数:11,代码来源:routes.py


示例4: Search

def Search():
    type = request.GET.get('type', entryService.types.query)
    value = request.GET.get('value', '')
    limit = int(request.GET.get('limit', config.limit))
    start = int(request.GET.get('start', config.start))
    
    url = '%s/?type=%s&value=%s&start=%d&limit=%d' % (config.search_url, type, value, start, limit)
    params = entryService.search(type, url, value, start, limit)
    if not params.entries == None:
        return template('search', params=params, config=config)
    return template('error', params=params, config=config)
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:11,代码来源:routes.py


示例5: PrivateRaw

def PrivateRaw(url):
    session = get_current_session()
    username = session.get('username', '')
    
    url = config.raw_url + url
    raw = entryService.find_raw(url)
    if not raw == None:
        response.headers['Content-Type'] = 'text/plain'
        response.headers['Content-Encoding'] = 'utf-8'
        return raw.strip()
    params = entryService.archive(entryService.types.raw, url, private=True, username=username)
    if params.entries == None:
        return template('error', params=params, config=config)
    return template('private', params=params, config=config)
开发者ID:JoneXiong,项目名称:YouMd,代码行数:14,代码来源:routes.py


示例6: db_tree

def db_tree():
    from over_view import get_all_trees
    import config
    try:
        cur_server_index = int(request.GET.get('s', '0'))
        cur_db_index = int(request.GET.get('db', '0'))
        cur_scan_cursor = int(request.GET.get('cursor', '0'))
    except:
        cur_server_index = 0
        cur_db_index = 0
        cur_scan_cursor = 0
    key = request.GET.get('k', '*')
    all_trees = get_all_trees(cur_server_index, key, db=cur_db_index, cursor=cur_scan_cursor)
    if type(all_trees) == list:
        next_scan_cursor, count = all_trees.pop()
        all_trees_json = json_dumps(all_trees)
        error_msg = ''
    else:
        next_scan_cursor, count = 0, 0
        all_trees_json = []
        error_msg = all_trees
    m_config = config.base
    return template('db_tree',
                    all_trees=all_trees_json,
                    config=m_config,
                    cur_server_index=cur_server_index,
                    cur_db_index=cur_db_index,
                    cur_scan_cursor=next_scan_cursor,
                    pre_scan_cursor=cur_scan_cursor,
                    cur_search_key=(key != '*' and key or ''),
                    count=count,
                    error_msg=error_msg,
                    media_prefix=media_prefix
                    )
开发者ID:JoneXiong,项目名称:PyRedisAdmin,代码行数:34,代码来源:routes.py


示例7: db_view

def db_view():
    try:
        cur_server_index = int(request.GET.get('s', 'server0').replace('server',''))
        cur_db_index = int(request.GET.get('db', 'db0').replace('db',''))
    except:
        cur_server_index = 0
        cur_db_index = 0
    key = request.GET.get('k', '*')
    return template("db_view",media_prefix=media_prefix, cur_server_index=cur_server_index, cur_db_index=cur_db_index, keyword=key)
开发者ID:abcddt,项目名称:PyRedisAdmin,代码行数:9,代码来源:routes.py


示例8: index

def index():
    from over_view import get_all_levels
    import config
    try:
        cur_server_index = int(request.GET.get('s', '0'))
    except:
        cur_server_index = 0
    all_levels_tree = get_all_levels(cur_server_index)
    m_config = config.base
    return template('index', all_levels_tree=all_levels_tree, config=m_config, cur_server_index=cur_server_index)
开发者ID:perryhau,项目名称:PyRedisAdmin,代码行数:10,代码来源:routes.py


示例9: db_view

def db_view():
    try:
        cur_server_index = int(request.GET.get("s", "server0").replace("server", ""))
        cur_db_index = int(request.GET.get("db", "db0").replace("db", ""))
    except:
        cur_server_index = 0
        cur_db_index = 0
    key = request.GET.get("k", "*")
    return template(
        "db_view", media_prefix=media_prefix, cur_server_index=cur_server_index, cur_db_index=cur_db_index, keyword=key
    )
开发者ID:JoneXiong,项目名称:PyRedisAdmin,代码行数:11,代码来源:routes.py


示例10: login

def login():
    if request.method == "POST":
        username = request.POST.get("username", "")
        password = request.POST.get("password", "")
        if password == config.admin_pwd and username == config.admin_user:
            session = get_current_session()
            session["username"] = username
            return {"code": 0, "msg": "OK"}
        else:
            return {"code": -1, "msg": "用户名或密码错误"}
    else:
        return template("auth/login.html", config=config, media_prefix=media_prefix)
开发者ID:JoneXiong,项目名称:PyRedisAdmin,代码行数:12,代码来源:routes.py


示例11: db_tree

def db_tree():
    from over_view import get_all_trees
    import config
    try:
        cur_server_index = int(request.GET.get('s', '0'))
        cur_db_index = int(request.GET.get('db', '0'))
    except:
        cur_server_index = 0
        cur_db_index = 0
    key = request.GET.get('k', '*')
    all_trees = get_all_trees(cur_server_index, key, db=cur_db_index)
    m_config = config.base
    return template('db_tree', all_trees=json_dumps(all_trees), config=m_config, cur_server_index=cur_server_index,cur_db_index=cur_db_index, media_prefix=media_prefix)
开发者ID:abcddt,项目名称:PyRedisAdmin,代码行数:13,代码来源:routes.py


示例12: view

def view():
    from data_view import general_html,title_html
    fullkey = request.GET.get('key', '')
    refmodel = request.GET.get('refmodel',None)
    
    cl,cur_server_index,cur_db_index = get_cl()
    if cl.exists(fullkey):
        title_html = title_html(fullkey, cur_server_index, cur_db_index)
        general_html = general_html(fullkey, cur_server_index, cur_db_index, cl)
        out_html = title_html + general_html
        if refmodel:
            return out_html
        else:
            return template('view', out_html=out_html, media_prefix=media_prefix)
    else:
        return '  This key does not exist.'
开发者ID:abcddt,项目名称:PyRedisAdmin,代码行数:16,代码来源:routes.py


示例13: view

def view():
    from config import base
    from redis_api import get_client
    from data_view import general_html,title_html
    try:
        sid = int(request.GET.get('s', '0'))
    except:
        sid = 0
    fullkey = request.GET.get('key', '')

    server = base['servers'][sid]
    cl = get_client()#get_client(host=server['host'], port=server['port'])
    if cl.exists(fullkey):
        title_html = title_html(fullkey, sid)
        general_html = general_html(fullkey, sid, cl)
        out_html = title_html + general_html
        #return template('view',template_adapter=Jinja2Template, out_html=out_html )
        return template('view', out_html=out_html )
    else:
        return '  This key does not exist.'
开发者ID:perryhau,项目名称:PyRedisAdmin,代码行数:20,代码来源:routes.py


示例14: Update

def Update(url):
    url = config.raw_url + url
    return template('update', raw_url=url)
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:3,代码来源:routes.py


示例15: server_view

def server_view():
    return template("main",media_prefix=media_prefix)
开发者ID:abcddt,项目名称:PyRedisAdmin,代码行数:2,代码来源:routes.py


示例16: Archive

def Archive(url):
    url= config.archive_url + url
    params = entryService.archive(entryService.types.entry, url)
    if params.entries == None:
        return template('error', params=params, config=config)
    return template('archive', params=params, config=config)
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:6,代码来源:routes.py


示例17: Index

def Index():
    limit = int(request.GET.get('limit', 10))
    start = int(request.GET.get('start', 1))
    params = entryService.search(entryService.types.index, config.index_url, '', start, limit)
    return template('index', params=params, config=config)
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:5,代码来源:routes.py


示例18: editor

def editor():
    return template('editor')
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:2,代码来源:routes.py


示例19: sitemap

def sitemap():
    params =  entryService.search(entryService.types.index, config.subscribe_url, limit=10000)
    response.headers['Content-Type'] = 'text/xml'
    return template('sitemap.html', params=params, config=config)
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:4,代码来源:routes.py


示例20: robots

def robots():
    response.headers['Content-Type'] = 'text/plain'
    return template('robots.html', config=config)
开发者ID:MaloneQQ,项目名称:YouMd,代码行数:3,代码来源:routes.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python molecule.Molecule类代码示例发布时间:2022-05-27
下一篇:
Python roboFont.CurrentFont类代码示例发布时间: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