From a3eee798f9b84ba5beab2d3978e9727a7f96d601 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Sun, 13 Oct 2013 01:49:04 -0400 Subject: [PATCH] Implement Category.__iter__() --- earwigbot/wiki/category.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/earwigbot/wiki/category.py b/earwigbot/wiki/category.py index 5422528..6707c43 100644 --- a/earwigbot/wiki/category.py +++ b/earwigbot/wiki/category.py @@ -58,6 +58,10 @@ class Category(Page): """Return a nice string representation of the Category.""" return ''.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",