def get_responce(self, *args, **kwargs): if args: since = int(args[0]) else: since = 0 s = Signatures.get_single() return dict(((hash, timestamp) for hash,timestamp in zip(s.hashes, s.times) if timestamp>since))
def _blog_fetch_callback(self, rpc): content = rpc.get_result().content d = feedparser.parse(StringIO(content)) s = Signatures.get_single() signatures_and_times = dict(zip(s.hashes, s.times)) posts = [] tags_entity = Tags.get_single() tags = set(tags_entity.available) for entry in d['entries']: blog_post = BlogPost.blog_post_from_feed_entry(entry) signature_time = signatures_and_times.get(blog_post.signature) if signature_time: signature_time = datetime.datetime.fromtimestamp(signature_time).strftime('%m/%d/%Y %H:%M') posts.append((blog_post, signature_time)) for tag in blog_post.tags: tags.add(tag.lower()) template_values = {"posts":posts} tags_entity.available = list(tags) tags_entity.save() template = jinja_environment.get_template('moderate.html') self.response.out.write(template.render(template_values))
def get_responce(self, *args, **kwargs): if args: since = int(args[0]) else: since = 0 s = Signatures.get_single() return dict(((hash, timestamp) for hash, timestamp in zip(s.hashes, s.times) if timestamp > since))