i needed hash to use Link objects as keys of dict. On 4/20/09, Liangent <[email protected]> wrote: > already committed? > > and there are some problems else: > > 1. > pywikibot.Page(pywikibot.Site(), 'talk:1').get() > this raises pywikibot.exceptions.Error > > 2. > (maybe a little bit difficult) > can you add transaction support for pywikibot? > > On 4/20/09, Nicolas Dumazet <[email protected]> wrote: >> Oh, interesting. >> >> For those wondering, this is related to Link in pywikibot.page (rewrite >> branch). >> >> What were you hashing Link objects for? >> >> What about: >> >> Index: pywikibot/page.py >> =================================================================== >> --- pywikibot/page.py (revision 6639) >> +++ pywikibot/page.py (working copy) >> @@ -1945,7 +1945,13 @@ >> return cmp(self.namespace, other.namespace) >> return cmp(self.title, other.title) >> >> + def __unicode__(self): >> + return self.astext() >> >> + def __hash__(self): >> + return hash(self.astext()) >> + >> + >> # Utility functions for parsing page titles >> >> def html2unicode(text, ignore = []): >> >> >> I believe that it should be correct, knowing that astext() should not >> change from one instance to another. >> >> -- >> Nicolas Dumazet — NicDumZ [ nɪk.d̪ymz ] >> >> _______________________________________________ >> Pywikipedia-l mailing list >> [email protected] >> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l >> >
_______________________________________________ Pywikipedia-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
