本文整理汇总了Python中transwarp.web.notfound函数的典型用法代码示例。如果您正苦于以下问题:Python notfound函数的具体用法?Python notfound怎么用?Python notfound使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了notfound函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
示例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
示例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()
示例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)
示例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()
示例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)
示例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))
示例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)
示例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)
示例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)
示例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)
示例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)
示例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)
示例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')
示例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)