当前位置: 首页>>代码示例>>Python>>正文


Python Entry.get方法代码示例

本文整理汇总了Python中models.Entry.get方法的典型用法代码示例。如果您正苦于以下问题:Python Entry.get方法的具体用法?Python Entry.get怎么用?Python Entry.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Entry的用法示例。


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

示例1: get

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def get(self, request, _id, *args, **kwargs):
     entry = Entry.get(_id)
     if not entry:
         raise Http404
     return render_to_response('detail.html', {
         'entry': entry,
     }, RequestContext(request))
开发者ID:davechenww,项目名称:ermiao-wysiwyg,代码行数:9,代码来源:views.py

示例2: post

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def post(self):
     key = self.get_argument("key", None)
     if key:
         entry = Entry.get(key)
         entry.title = self.get_argument("title")
         entry.markdown = self.get_argument("markdown")
         entry.html = markdown.markdown(self.get_argument("markdown"))
     else:
         title = self.get_argument("title")
         slug = unicodedata.normalize("NFKD", title).encode(
             "ascii", "ignore")
         slug = re.sub(r"[^\w]+", " ", slug)
         slug = "-".join(slug.lower().strip().split())
         if not slug: slug = "entry"
         while True:
             existing = db.Query(Entry).filter("slug =", slug).get()
             if not existing or str(existing.key()) == key:
                 break
             slug += "-2"
         entry = Entry(
             author=self.current_user,
             title=title,
             slug=slug,
             markdown=self.get_argument("markdown"),
             html=markdown.markdown(self.get_argument("markdown")),
         )
     entry.put()
     self.redirect("/entry/" + entry.slug)
开发者ID:footlooze,项目名称:Kowloon-Ice-House,代码行数:30,代码来源:main.py

示例3: get

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def get(self, key):
     try:
         entry = Entry.get(key)
         entry.delete()
         self.json({"success":1})
     except:
         self.json({"success":0, "error": "参数错误"})
开发者ID:youngpay,项目名称:myblog,代码行数:9,代码来源:admin.py

示例4: remove_view

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
def remove_view(entry_id):
    user = Session.get_user()

    if Entry.select().where(Entry.id == entry_id, Entry.user == user, Entry.is_active == True).exists():
        entry = Entry.get(Entry.user == user, Entry.is_active == True)
        entry.is_active = False
        entry.save()
    else:
        abort(404)

    return redirect(URLS['index'])
开发者ID:kmasaya,项目名称:bottle.peewee.template,代码行数:13,代码来源:index.py

示例5: post

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def post(self):
   key = self.request.get('key')
   try:
     e = Entry.get(key)
     e.content = self.request.get('content')
     e.put()
     self.redirect("/")
   except Exception as e:
     self.response.out.write(indexTemplate.render({
       'title': 'Append to Entry',
       'body': "Error: No entry for key %s, exception %s" % (key, e)
     }))
开发者ID:Mononofu,项目名称:infinite-diary,代码行数:14,代码来源:diary.py

示例6: get

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
  def get(self, key):
    e = Entry.get(key)
    body = entryEditTemplate.render({
      'entry_day': e.date.strftime("%A, %d %B"),
      'content': e.content,
      'key': e.key()
    })

    self.response.out.write(indexTemplate.render({
      'title': 'Append to Entry',
      'body': body
    }))
开发者ID:Mononofu,项目名称:infinite-diary,代码行数:14,代码来源:diary.py

示例7: new_view

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
def new_view(parent_id=None):
    user = Session.get_user()

    if parent_id and Entry.select().where(Entry.id == parent_id, Entry.is_active == True).exists():
        parent = Entry.get(Entry.id == parent_id, Entry.is_active == True)
    else:
        parent = None

    title = views.form_get('title', 'no title')
    body = views.form_get('body', '')

    Entry.create(
        user=user,
        parent=parent,
        title=title,
        body=body,
    )

    return redirect(URLS['index'])
开发者ID:kmasaya,项目名称:bottle.peewee.template,代码行数:21,代码来源:index.py

示例8: post

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
    def post(self, key):
        entry = Entry.get(key)
        
        title = self.get_argument("title", default=None)
        if title is None or len(title) == 0:
            self.view("admin/article-edit.html", menuIndex=1, error=u"请输入标题")
            return
        source = self.get_argument("cleanSource", default=" ")
        html = self.get_argument("content", default=" ")
        slug = self.get_argument("slug", default=" ")

        date = datetime.datetime.now() + datetime.timedelta(hours=8)
        entry.title = title
        entry.body_source = source
        entry.html = html
        entry.slug = slug
        entry.updated = date
        entry.put()
        self.dispatch(msg=u"修改成功", to=u"文章列表页", toUrl="/admin/article", seconds=2)
开发者ID:youngpay,项目名称:myblog,代码行数:21,代码来源:admin.py

示例9: handle_GET

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def handle_GET(self, reactor, entry_id):
     return Entry.get(entry_id, exc_class=HttpNotFound).get_dict()
开发者ID:superisaac,项目名称:rainy,代码行数:4,代码来源:entry.py

示例10: handle_POST

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def handle_POST(self, reactor, entry_id):
     entry = Entry.get(entry_id)
     if entry.owner_id != reactor.user.id:
         raise Forbidden()
     entry.delete()
     return ok("Delete OK")
开发者ID:superisaac,项目名称:rainy,代码行数:8,代码来源:entry.py

示例11: post

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def post(self, ordinal):
   e = Entry.get(self.request.get('key'))
   h = Highlight(period='month', entry=e, date=date.fromordinal(int(ordinal)))
   h.put()
   self.redirect('/highlights')
开发者ID:Mononofu,项目名称:infinite-diary,代码行数:7,代码来源:highlight.py

示例12: get

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def get(self, key):
     post = Entry.get(key)
     self.view("post.html", post=post)
开发者ID:youngpay,项目名称:myblog,代码行数:5,代码来源:controllers.py

示例13: get

# 需要导入模块: from models import Entry [as 别名]
# 或者: from models.Entry import get [as 别名]
 def get(self):
     key = self.get_argument("key", None)
     entry = Entry.get(key) if key else None
     self.render("compose.html", entry=entry)
开发者ID:footlooze,项目名称:Kowloon-Ice-House,代码行数:6,代码来源:main.py


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