M src/wiki/models/article.py => src/wiki/models/article.py +3 -6
@@ 88,14 88,12 @@ class Article(models.Model):
def ancestor_objects(self):
"""NB! This generator is expensive, so use it with care!!"""
for obj in self.articleforobject_set.filter(is_mptt=True):
- for ancestor in obj.content_object.get_ancestors():
- yield ancestor
+ yield from obj.content_object.get_ancestors()
def descendant_objects(self):
"""NB! This generator is expensive, so use it with care!!"""
for obj in self.articleforobject_set.filter(is_mptt=True):
- for descendant in obj.content_object.get_descendants():
- yield descendant
+ yield from obj.content_object.get_descendants()
def get_children(self, max_num=None, user_can_read=None, **kwargs):
"""NB! This generator is expensive, so use it with care!!"""
@@ 106,8 104,7 @@ class Article(models.Model):
**kwargs).can_read(user_can_read)
else:
objects = obj.content_object.get_children().filter(**kwargs)
- for child in objects.order_by(
- 'articles__article__current_revision__title'):
+ for child in objects.order_by('articles__article__current_revision__title'):
cnt += 1
if max_num and cnt > max_num:
return
M src/wiki/plugins/macros/mdx/toc.py => src/wiki/plugins/macros/mdx/toc.py +1 -2
@@ 49,8 49,7 @@ def itertext(elem):
if elem.text:
yield elem.text
for e in elem:
- for s in itertext(e):
- yield s
+ yield from itertext(e)
if e.tail:
yield e.tail