[Pywikipedia-l] [Pywikipedia-svn] SVN: [8571] trunk/pywikipedia/wikipedia.py

Dr. Trigon dr.trigon at surfeu.ch
Sun Sep 19 09:40:11 UTC 2010


Works like a charm! Thanks a lot!!

Greetings

Am 17.09.2010 11:20, schrieb xqt at svn.wikimedia.org:
> Revision: 8571
> Author:   xqt
> Date:     2010-09-17 09:20:40 +0000 (Fri, 17 Sep 2010)
>
> Log Message:
> -----------
> NoPage and BadTitle exceptions for _getVersionHistory, requested by DrTrigon
>
> Modified Paths:
> --------------
>      trunk/pywikipedia/wikipedia.py
>
> Modified: trunk/pywikipedia/wikipedia.py
> ===================================================================
> --- trunk/pywikipedia/wikipedia.py	2010-09-17 05:41:56 UTC (rev 8570)
> +++ trunk/pywikipedia/wikipedia.py	2010-09-17 09:20:40 UTC (rev 8571)
> @@ -2615,6 +2615,13 @@
>               result = query.GetData(params, self.site())
>               if 'error' in result:
>                   raise RuntimeError("%s" % result['error'])
> +            pageInfo = result['query']['pages'].values()[0]
> +            if result['query']['pages'].keys()[0] == "-1":
> +                if 'missing' in pageInfo:
> +                    raise NoPage(self.site(), self.aslink(forceInterwiki=True),
> +                                 "Page does not exist.")
> +                elif 'invalid' in pageInfo:
> +                    raise BadTitle('BadTitle: %s' % self)
>
>               if 'query-continue' in result and getAll:
>                   params['rvstartid'] = result['query-continue']['revisions']['rvstartid']
> @@ -2624,7 +2631,7 @@
>               if skipFirst:
>                   skipFirst = False
>               else:
> -                for r in result['query']['pages'].values()[0]['revisions']:
> +                for r in pageInfo['revisions']:
>                       c = ''
>                       if 'comment' in r:
>                           c = r['comment']
>
>
>
> _______________________________________________
> Pywikipedia-svn mailing list
> Pywikipedia-svn at lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn
>




More information about the Pywikipedia-l mailing list