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

Python model.Entry类代码示例

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

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



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

示例1: test_get

 def test_get(self):
     context = Context(http=MockHttp(HTTP_SRC_DIR), entry="http://example.org/entry/67")
     entry = Entry(context)
     (headers, body) = entry.get()
     self.assertEqual(200, headers.status)
     self.assertFalse(entry.has_media())
     self.assertEqual(entry.uri(), "http://example.org/entry/67")
开发者ID:myblup,项目名称:atompubbase,代码行数:7,代码来源:test_entry.py


示例2: saveEntry

	def saveEntry(self):
		"""
		Updates an entry
		"""
		contents = self.entry.get(1.0, tkinter.END)
		Entry.updateEntry(self.currDate, contents)
		self.updateStatusBar("Last action: " + str(self.currDate) + " - Entry updated")
开发者ID:hanleychan,项目名称:diary,代码行数:7,代码来源:diary.py


示例3: test_put

 def test_put(self):
     context = Context(http=MockHttp(HTTP_SRC_DIR), entry="http://example.org/entry/67")
     entry = Entry(context)
     (headers, body) = entry.put(body="<entry></entry>")
     self.assertEqual(200, headers.status)
     self.assertFalse(entry.has_media())
     self.assertEqual(0, len(body))
开发者ID:myblup,项目名称:atompubbase,代码行数:7,代码来源:test_entry.py


示例4: get

    def get(self, page_id="", operation=""):
        t_values = {}
        logging.info("PageManager get: page_id = %s, operation = %s" % (page_id, operation))

        # find current_post based on page_id
        if page_id:
            current_post = Entry.get_by_id(long(page_id))
            if current_post:
                logging.info("find post %s from post id %s" % (page_id, current_post.title))
                if operation == "edit":
                    t_values['current_post'] = current_post
                elif operation == "publish":
                    current_post.is_external_page = True
                    current_post.put()
                    t_values['alert_message'] = "Post %s has been changed to public" % (current_post.title)
                elif operation == "unpublish":
                    current_post.is_external_page = False
                    current_post.put()
                    t_values['alert_message'] = "Post %s has been changed to private" % (current_post.title)
                elif operation == "delete":
                    current_post.delete()
                    t_values['alert_message'] = "Post %s has been changed to deleted" % (current_post.title)

        # show all posts
        posts = Entry.all().filter("entrytype =", 'page')
        t_values['posts'] = posts
        return self.response.out.write(render_template("pages.html", t_values, "", True))
开发者ID:loongw,项目名称:another-gae-blog,代码行数:27,代码来源:admin.py


示例5: get

    def get(self, page_slug=""):
        if page_slug:
            t_values = {}

            posts = Entry.all().filter("is_external_page =", True).filter("entrytype =", 'page').filter("slug =", page_slug)
            if posts.count() == 1:
                logging.warning("find one page with slug=%s" % (page_slug))
                posts = posts.fetch(limit=1)
                post = posts[0]
                t_values['post'] = post
                # dump(post)

                # find all comments
                comments = Comment.all().filter("entry =", post).order("date")
                t_values['comments'] = comments
            else:
                logging.warning("%d entries share the same slug %s" % (posts.count(), page_slug))

            links = Link.all().order("date")
            t_values['links'] = links

            categories = Category.all()
            t_values['categories'] = categories

            pages = Entry.all().filter("is_external_page =", True).filter("entrytype =", 'page').order("date")
            t_values['pages'] = pages

            return self.response.out.write(render_template("page.html", t_values, "basic", False))
        else:
            self.redirect(uri_for("weblog.index"))
开发者ID:loongw,项目名称:another-gae-blog,代码行数:30,代码来源:weblog.py


示例6: deleteEntry

	def deleteEntry(self):
		"""
		Deletes an entry
		"""
		Entry.deleteEntry(self.currDate)
		self.entry.delete(1.0, tkinter.END)
		self.updateStatusBar("Last action: " + str(self.currDate) + " - Entry deleted")
开发者ID:hanleychan,项目名称:diary,代码行数:7,代码来源:diary.py


示例7: test_put_media

 def test_put_media(self):
     context = Context(http=MockHttp(HTTP_SRC_DIR), entry="http://example.org/images/77")
     entry = Entry(context)
     (headers, body) = entry.get()
     self.assertEqual(200, headers.status)
     self.assertTrue(entry.has_media())
     (headers, body) = entry.put_media(headers={}, body="")
     self.assertEqual(202, headers.status)  # We don't really expect 202 from a PUT, just testing.
开发者ID:myblup,项目名称:atompubbase,代码行数:8,代码来源:test_entry.py


示例8: test_get_media

 def test_get_media(self):
     context = Context(http=MockHttp(HTTP_SRC_DIR), entry="http://example.org/images/77")
     entry = Entry(context)
     (headers, body) = entry.get()
     self.assertEqual(200, headers.status)
     self.assertTrue(entry.has_media())
     (headers, body) = entry.get_media()
     self.assertEqual(200, headers.status)
     self.assertTrue(headers["content-type"], "image/jpg")
     self.assertEqual(7483, len(body))
开发者ID:myblup,项目名称:atompubbase,代码行数:10,代码来源:test_entry.py


示例9: post

    def post(self):
        target = self.request.get('target')
        amount = int(self.request.get('amount'))
        location = self.request.get('location')
        date = datetime.datetime.strptime(self.request.get('date'), '%Y-%m-%d').date()
        succeed = True#self.request.get('succeed')
        story = self.request.get('story')
         
        entry = Entry(target=target, amount=amount, location=location, date=date, succeed=succeed, story=story, author=users.get_current_user())
        entry.put()

        self.redirect('/')
开发者ID:yaozhifeng,项目名称:i-bribe,代码行数:12,代码来源:main.py


示例10: get

  def get(self):
    task = self.request.get("task")
    if task == "cleanup":
      # Remove obsolete entries
      Entry.cleanup()
    elif task == "subscribe":
      # Periodically make subscribe request
      #
      # Priorily subscribe to newly added channel (i.e. status == None);
      # if there aren't any, then confirm the least checked subscription.
      ch = Channel.all().filter("status =", None).get()
      if not ch:
	ch = Channel.all().filter("status =",
	            "subscribed").order("lastcheck").get()
      ch.subscribe()
    else: self.error(404)
开发者ID:juvenn,项目名称:microupdater,代码行数:16,代码来源:croned.py


示例11: post

 def post(self, user_id, feed_id, entry_id):
     """Updates a specific entry"""
     current_user = utils.get_current_user()
     
     if not current_user:
         self.error(403)
         return
     
     user = User.get_by_id(int(user_id))
     
     if user == None:
         self.error(404)
         return
     
     if current_user.key() != user.key():
         self.error(401)
         return
     
     feed = InputFeed.get_by_id(int(feed_id), parent=user)
     
     if feed == None:
         self.error(404)
         return
     
     entry = Entry.get_by_id(int(entry_id), parent=feed)
     
     published = self.request.get('published')
     
     if published != None:
         entry.published = bool(int(published))
         entry.save()
     
     self.response.headers['Content-Type'] = 'application/json; charset=utf-8'
     self.response.headers['Access-Control-Allow-Origin'] = '*'
     self.response.out.write(json.dumps(entry.to_struct()))
开发者ID:studyindenmark,项目名称:newscontrol,代码行数:35,代码来源:entries.py


示例12: get

  def get(self):
    context = {}
    query = Entry.all().order("-updated")
    next = self.request.get("next")
    if next:
      dt = datetime.strptime(next, "%Y-%m-%dT%H:%M:%S")
      entries = query.filter("updated <=",
	  dt).fetch(PAGESIZE + 1)
      if len(entries) == PAGESIZE + 1:
	context["next"] = entries[-1].updated.isoformat("T")
      else:
	context["next"] = None
      context["entries"] = entries[:PAGESIZE]
      self.response.out.write(self.render_sec_entries(context))
      return
    else:
      sec = {}
      entries = query.fetch(PAGESIZE + 1)
      if len(entries) == PAGESIZE + 1:
	context["next"] = entries[-1].updated.isoformat("T")
      else:
	context["next"] = None
      context["entries"] = entries[:PAGESIZE]
      sec["entries"] = self.render_sec_entries(context)

      sec["featured"] = self.render_sec_featured()
      path = templatepath("main.html")
      self.response.out.write(template.render(path, sec))
开发者ID:juvenn,项目名称:microupdater,代码行数:28,代码来源:main.py


示例13: delete

    def delete(self, title):
        """Delete the specified tag for the current user"""
        user = utils.get_current_user()
        
        title = title.decode('utf-8')
        
        if not user:
            self.error(403)
            return
            
        m = Tag.all().ancestor(user).filter('title_lower =', title.lower()).get()
        if not m:
            # Original tag not found
            self.error(404)
            return

        entries = Entry.all().filter('tags =', m.key())

        # Remove tag from entries
        for entry in entries:
            logging.info(entry)
            entry.tags.remove(m.key())
            entry.save()
        
        m.delete()

        self.response.headers['Content-Type'] = 'text/plain; charset=utf-8'
        self.response.headers['Access-Control-Allow-Origin'] = '*'
        self.response.out.write('ok')
开发者ID:studyindenmark,项目名称:newscontrol,代码行数:29,代码来源:tags.py


示例14: EntryHandler_postTest

 def EntryHandler_postTest(self):
     weight = 75.0
     variance = 1.4
     currDate = "2012-10-10"
     currDt =dt.date(2012, 10, 10)
     nick= users.get_current_user().nickname()
     head = {"Content-Type" : "application/x-www-form-urlencoded", "Accept" : "text/plain"}
     payload = urlencode({"date" : currDate, "variance" : float(variance),"weight":float(weight)})
     #request = requests.Request("POST","/users/%s/"%nick, data=payload)
     request = webapp2.Request.blank('/users/%s/entry/%s'%(nick,currDate))
     request.method="POST"
     request.headers=head
     request.body=payload
     currUser=users.get_current_user()
     response = webapp2.Response()
     handler = EntryHandler()
     handler.initialize(request, response)
     handler.post(user=None,cd=None)
     self.setCurrentUser("[email protected]", "aaaaaaa")
     userId=users.get_current_user().user_id()
     db.delete(Entry.all())
     nick=users.get_current_user().nickname()
     handler.post(user=nick,cd='2012-10-10')
     Entry(weight=100.0, variance=5.0,date=currDt,user=currUser, parent=log_key(userId)).put()
     handler.post(user=nick,cd='2012-10-10')
     db.delete(Biometric.all())
     Biometric(height=150, target=73.3, parent=bio_key(currUser.user_id())).put()
     handler.post(user=nick,cd='2012-10-10')
     #Put Test
     handler.put(user=nick,cd='2012-10-10')
     handler.put(user=nick,cd='2012-10-15')
     handler.delete(user=nick,cd='2012-10-10')
开发者ID:acantatore,项目名称:Chompanion,代码行数:32,代码来源:SUT_Chompanion.py


示例15: get

 def get(self, **kwargs):
     """Return current status
     """
     e = Entry.latest()
     if e:
         return e.as_dict()
     return {}
开发者ID:quodt,项目名称:etaui,代码行数:7,代码来源:service.py


示例16: get

    def get(self, user, tag_title):
        """Gets RSS feed for a user, filtered by tag"""
        user = utils.get_user_model_by_id_or_nick(user)
        
        if not user:
            self.error(403)
            return
            
        tag_title = tag_title.decode('utf-8')
        tag = Tag.all().ancestor(user.key()).filter('title_lower =', tag_title.lower()).get()

        if not tag:
            self.error(404)
            return

        entries = Entry.all().filter('tags =', tag.key()).filter('published =', True).order('-time_published').fetch(20)
        entries = [e.to_struct() for e in entries]
            
        path = os.path.join(os.path.dirname(__file__), 'template.rss')
        self.response.headers['Content-Type'] = 'application/xml; charset=utf-8'
        self.response.out.write(template.render(path, {
            'entries': entries,
            'url': self.request.url,
            'title': tag_title,
        }))
开发者ID:studyindenmark,项目名称:newscontrol,代码行数:25,代码来源:rss.py


示例17: update_basic_info

	def update_basic_info(
		update_categories=False,
		update_tags=False,
		update_links=False,
		update_comments=False,
		update_archives=False,
		update_pages=False):

		from model import Entry,Archive,Comment,Category,Tag,Link
		basic_info = ObjCache.get(is_basicinfo=True)
		if basic_info is not None:
			info = ObjCache.get_cache_value(basic_info.cache_key)
			if update_pages:
				info['menu_pages'] = Entry.all().filter('entrytype =','page')\
							.filter('published =',True)\
							.filter('entry_parent =',0)\
							.order('menu_order').fetch(limit=1000)
			if update_archives:
				info['archives'] = Archive.all().order('-year').order('-month').fetch(12)
			if update_comments:
				info['recent_comments'] = Comment.all().order('-date').fetch(5)
			if update_links:
				info['blogroll'] = Link.all().filter('linktype =','blogroll').fetch(limit=1000)
			if update_tags:
				info['alltags'] = Tag.all().order('-tagcount').fetch(limit=100)
			if update_categories:
				info['categories'] = Category.all().fetch(limit=1000)

			logging.debug('basic_info updated')
			basic_info.update(info)
开发者ID:fly2014,项目名称:XBLOG,代码行数:30,代码来源:cache.py


示例18: getTagsForUrl

def getTagsForUrl(url):
    try:
        content = resource.get(url).decodeBody().lower()
    except:
        content = ""
    
    soup = BeautifulSoup(content) 
    texts = soup.findAll(text=True)

    def visible(element):
        if element.parent.name in ['style', 'script', '[document]', 'head', 'title']:
            return False
        elif re.match('<!--.*-->', str(element)):
            return False
        return True
    
    visible_texts = filter(visible, texts)
    visibleText = " ".join(visible_texts)
    
    result = getTagsProposalsForText(visibleText)
    
    entry = Entry.all().filter("url =", url).fetch(1)
    if len(entry) > 0:
        entryStableTags = entry[0].tags
        for t in entryStableTags:
            found = False
            name = Tag.get(t).name
            for r in result:
                if name == r:
                    found = True
            if not found:
                result.append(name)
                
    return result
开发者ID:outbounder,项目名称:api-techbrowser,代码行数:34,代码来源:tags.py


示例19: delete

    def delete(self, id):
        e = Entry.get(Entry.id == id)
        if not e:
            self.write({'status':'error'})
            return

        e.delete_instance()
        self.write({'status':'success'})
开发者ID:zqqf16,项目名称:clipboard,代码行数:8,代码来源:handler.py


示例20: get

	def get (self):
		offset = self.request.get('offset')
		if not offset:
			offset = 0
		e = Entry.all().order('addtime')
		e = e.fetch(10,int(offset))
		path = os.path.join(os.path.dirname(__file__),'templates/export.tpl')
		self.response.out.write(template.render(path,{'e':e}))	
开发者ID:zerofault-cn,项目名称:zerofault,代码行数:8,代码来源:dump.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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