Pārlūkot izejas kodu

Implement Category.__iter__()

tags/v0.2
Ben Kurtovic pirms 10 gadiem
vecāks
revīzija
a3eee798f9
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. +4
    -0
      earwigbot/wiki/category.py

+ 4
- 0
earwigbot/wiki/category.py Parādīt failu

@@ -58,6 +58,10 @@ class Category(Page):
"""Return a nice string representation of the Category."""
return '<Category "{0}" of {1}>'.format(self.title, str(self.site))

def __iter__(self):
"""Iterate over all members of the category."""
return self.get_members()

def _get_members_via_api(self, limit, follow):
"""Iterate over Pages in the category using the API."""
params = {"action": "query", "list": "categorymembers",


Notiek ielāde…
Atcelt
Saglabāt