소스 검색

this should work as generator too

Oz N Tiram 9 년 전
부모
커밋
64f90adbf6
1개의 변경된 파일3개의 추가작업 그리고 5개의 파일을 삭제
  1. 3 5
      blogit/blogit.py

+ 3 - 5
blogit/blogit.py

@@ -102,15 +102,13 @@ class Tag(object):
 
     @property
     def entries(self):
-        _entries = []
+        """return the actual lists of entries tagged with"""
         Posts = Query()
         for id in self.posts:
             post = DB.posts.get(eid=id)
             if not post:  # pragma: no coverage
-                raise ValueError("no post found for eid %s" % id)
-            entry = Entry(post['filename'])
-            _entries.append(entry)
-        return _entries
+                 raise ValueError("no post found for eid %s" % id)
+            yield Entry(post['filename'])
 
     def render(self):
         """Render html page and atom feed"""