Revision: 6665 Author: russblau Date: 2009-04-22 14:01:22 +0000 (Wed, 22 Apr 2009)
Log Message: ----------- Streamlining Page.__cmp__(), similar to recent changes to trunk
Modified Paths: -------------- branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py =================================================================== --- branches/rewrite/pywikibot/page.py 2009-04-22 13:30:59 UTC (rev 6664) +++ branches/rewrite/pywikibot/page.py 2009-04-22 14:01:22 UTC (rev 6665) @@ -235,13 +235,11 @@ if not isinstance(other, Page): # especially, return -1 if other is None return -1 - if not self.site() == other.site(): - return cmp(self.site(), other.site()) - if self.namespace() != other.namespace(): - return cmp(self.namespace(), other.namespace()) - owntitle = self.title(withNamespace=False) - othertitle = other.title(withNamespace=False) - return cmp(owntitle, othertitle) + if self._site != other._site: + return cmp(self._site, other._site) + if self._ns != other._ns: + return cmp(self._ns, other._ns) + return cmp(self._title, other._title)
def __hash__(self): # Pseudo method that makes it possible to store Page objects as keys
pywikipedia-svn@lists.wikimedia.org