本文整理汇总了Python中transwarp.web.notfound函数的典型用法代码示例。如果您正苦于以下问题:Python notfound函数的具体用法?Python notfound怎么用?Python notfound使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notfound函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: api_delete_navigation
def api_delete_navigation(nid):
if not nid:
raise notfound()
nav = Navigations.get_by_id(nid)
if nav is None:
raise notfound()
nav.delete()
_clear_navigations_cache()
return dict(result=True)
开发者ID:michaelliao,项目名称:brighterpage,代码行数:9,代码来源:__init__.py
示例2: _manage
def _manage(app, func):
if ctx.user is None:
raise seeother('/auth/signin')
mod = _apps.get(app, None)
if mod is None:
raise notfound()
fn = getattr(mod, func, None)
if fn is None:
raise notfound()
r = fn()
if isinstance(r, Template):
r.model['__user__'] = ctx.user
r.model['__apps__'] = _apps_list
return r
开发者ID:michaelliao,项目名称:brighterpage,代码行数:14,代码来源:manage.py
示例3: api_edit_scan
def api_edit_scan(type, id):
check_admin()
if type == "sqlmap":
sqlmap = Sqlmap.find_by('where id = ?', content_escape(id))
return dict(type=content_escape(type), id=content_escape(id), sqlmap=content_escape(sqlmap))
else:
raise notfound()
开发者ID:akz747,项目名称:NagaScan,代码行数:7,代码来源:urls.py
示例4: pageviews
def pageviews(page_id):
pageview = Pageviews.get(page_id)
if pageview is None:
raise notfound()
pageview.html_content = markdown2.markdown(pageview.page_value)
#comments = Comment.find_by('where blog_id=? order by created_at desc limit 1000', blog_id)
return dict(pageview=pageview, user=ctx.request.user)
开发者ID:tangchenxuan,项目名称:yoho-appiumn-python-webapp,代码行数:7,代码来源:urls.py
示例5: _get_attachment
def _get_attachment(atta_id, index):
atta = Attachments.get_by_id(atta_id)
if atta:
rs = atta.resource_ids.split(',')
if index >= (-1) and index < len(rs):
return _get_resource(rs[index])
raise notfound()
开发者ID:michaelliao,项目名称:brighterpage,代码行数:7,代码来源:__init__.py
示例6: manage_blogs_edit
def manage_blogs_edit(blog_id):
'''管理_修改日志页 GET VIEW'''
blog = Blog.get(blog_id)
if blog is None:
raise notfound()
print 'GET VIEW /manage/blogs/edit/:blog_id dict = %s' % dict(id=blog.id, name=blog.name, summary=blog.summary, content=blog.content, action='/api/blogs/%s' % blog_id, redirect='/manage/blogs', user=ctx.request.user)
return dict(id=blog.id, name=blog.name, summary=blog.summary, content=blog.content, action='/api/blogs/%s' % blog_id, redirect='/manage/blogs', user=ctx.request.user)
开发者ID:love123i,项目名称:awesome-python-webapp,代码行数:7,代码来源:urls.py
示例7: api_view_request
def api_view_request(request_rid):
check_admin()
request = Request.find_by('where rid = ?', request_rid)
response = Response.find_by('where rid = ?', request_rid)
if request is None or response is None:
raise notfound()
return dict(request=content_escape(request), response=html_encode(response))
开发者ID:akz747,项目名称:NagaScan,代码行数:7,代码来源:urls.py
示例8: blog
def blog(blog_id):
blog = Blog.get(blog_id)
if blog is None:
raise notfound()
blog.html_content = markdown2.markdown(blog.content) # change content to html form
comments = Comment.find_by('where blog_id=? order by created_at desc limit 1000', blog_id)
return dict(blog=blog, comments=comments, user=ctx.request.user)
开发者ID:dasbindus,项目名称:my-python-webapp,代码行数:7,代码来源:urls.py
示例9: blog
def blog(blog_id):
blog = Blogs.get(blog_id)
if not blog:
raise notfound()
if blog.tags:
blog.xtags = blog.tags.split(',')
rps = Blogs.find_by('order by created desc limit ?', 3)
return dict(blog=blog, rps=rps)
开发者ID:zhu327,项目名称:blog,代码行数:8,代码来源:urls.py
示例10: blog
def blog(blog_id):
blog = Blog.get(blog_id)
if blog is None:
raise notfound()
#对从数据库中查出的blog内容进行makedown语法格式化
blog.html_content = markdown2.markdown(blog.content)
comments = Comment.find_by('where blog_id=? order by created_at desc limit 100', blog_id)
return dict(blog=blog, comments=comments, user=ctx.request.user)
开发者ID:akicqi,项目名称:python_mini_blog,代码行数:8,代码来源:urls.py
示例11: api_delete_article
def api_delete_article(aid):
a = Articles.get_by_id(aid)
if a is None:
raise notfound()
a.delete()
uploaders.delete_attachment(a.cover_id)
comments.delete_comments(aid)
return dict(result=True)
开发者ID:michaelliao,项目名称:brighterpage,代码行数:8,代码来源:__init__.py
示例12: blog
def blog(blog_id):
import pdb
pdb.set_trace()
blog = Blog.get(blog_id)
if blog is None:
raise notfound()
blog.html_content = markdown2.markdown(blog.content)
comments = Comment.find_by('where blog_id=? order by created_at desc limit 1000',blog_id)
return dict(blog=blog, comments=comments, user=ctx.request.user)
开发者ID:danolphoenix,项目名称:awesome-python-webapp,代码行数:9,代码来源:urls.py
示例13: archives
def archives():
years = db.select('select distinct `year` from `blogs` order by created desc')
if not years:
raise notfound()
xblogs = list()
for y in years:
blogs = Blogs.find_by('where `year` = ? order by created desc', y.get('year'))
xblogs.append(blogs)
return dict(xblogs=xblogs)
开发者ID:1007650105,项目名称:blog,代码行数:9,代码来源:urls.py
示例14: contactlist
def contactlist(id):
contact = Contact.find_first('where id=?',id)
if contact is None:
raise notfound()
contactlist = Contact.find_by('where groupid=?',contact.groupid)
if contactlist:
return dict(contactlist=contactlist,group=contact.groupid)
else:
raise APIResourceNotFoundError(contact.groupid,'failed')
开发者ID:longfan3,项目名称:contact,代码行数:9,代码来源:urls.py
示例15: web_category
def web_category(cid):
category = Categories.get_by_id(cid)
if category is None:
raise notfound()
page, articles = page_select(Articles, 'where category_id=? and publish_time<?', 'where category_id=? and publish_time<? order by publish_time desc', cid, time.time())
reads = counters.counts((a._id for a in articles))
for a, r in zip(articles, reads):
a.reads = r
return dict(category=category, page=page, articles=articles)
开发者ID:michaelliao,项目名称:brighterpage,代码行数:9,代码来源:__init__.py
示例16: _get_resource
def _get_resource(rid, url=None):
logging.info('Get resource: %s, %s' % (rid, url))
r = db.select_one('select url, mime, size, data from resources where _id=?', rid)
if url and r.url!=url:
raise notfound()
resp = ctx.response
resp.content_type = r.mime
resp.content_length = r.size
return r.data
开发者ID:michaelliao,项目名称:brighterpage,代码行数:9,代码来源:__init__.py
示例17: _get_site
def _get_site(host):
wss = db.select('select * from websites where domain=?', host)
if wss:
ws = wss[0]
if ws.disabled:
logging.debug('website is disabled: %s' % host)
raise forbidden()
return ws
raise notfound()
开发者ID:a740122,项目名称:itranswarp,代码行数:9,代码来源:loader.py
示例18: api_view_scan
def api_view_scan(type):
check_admin()
if type == "sqlmap":
total = Sqlmap.count_all()
page = Page(total, _get_page_index())
sqlmaps = Sqlmap.find_by('order by update_time desc limit ?,?', page.offset, page.limit)
return dict(type=content_escape(type), sqlmaps=content_escape(sqlmaps), page=page)
else:
raise notfound()
开发者ID:akz747,项目名称:NagaScan,代码行数:9,代码来源:urls.py
示例19: web_wikipage
def web_wikipage(wid, pid):
page = _get_full_wikipage(pid)
if page.wiki_id != wid:
raise notfound()
wiki = _get_wiki(wid)
tree = _get_wikipages(wiki)
content = texts.md2html(texts.get(page.content_id))
page.reads = counters.incr(pid)
return dict(wiki=wiki, page=page, tree=tree, name=page.name, content=content, comments=comments.get_comments(pid))
开发者ID:michaelliao,项目名称:brighterpage,代码行数:9,代码来源:__init__.py
示例20: api_create_article_comment
def api_create_article_comment(aid):
u = ctx.user
if u is None:
raise APIPermissionError()
i = ctx.request.input(content='')
content = assert_not_empty(i.content, 'content')
a = Articles.get_by_id(aid)
if a is None:
raise notfound()
return comments.create_comment('article', aid, content)
开发者ID:michaelliao,项目名称:brighterpage,代码行数:10,代码来源:__init__.py
注:本文中的transwarp.web.notfound函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论