예제 #1
0
 def _get_tags(self):
     pages = filter(self.cond(is_inst=source.ParseableSource), self._cache)
     tags = set()
     counter = dict()
     for page in pages:
         for tag in page.data('tags'):
             tag = tag['name']
             tags.add(tag)
             counter[tag] = counter.get(tag, 0) + 1
     for tag in tags:
         yield {
             'name': tag,
             'count': counter[tag],
             'url': helpers.tag_url(tag),
         }
예제 #2
0
 def _tags(value):
     """Parses tags from comma-separaed string, or returns default
     tags set from configuration."""
     tags = list(helpers.xsplit(",", value, strip=True, drop_empty=True))
     for tag in tags or conf.get("default_tags"):
         yield {"name": tag, "url": helpers.tag_url(tag)}