Bugs item #1981416, was opened at 2008-06-01 19:49 Message generated for change (Comment added) made by nicdumz You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1981416...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: None
Status: Closed Resolution: Fixed
Priority: 5 Private: No Submitted By: Sébastien Rombauts (srombauts)
Assigned to: NicDumZ — Nicolas Dumazet (nicdumz)
Summary: Add the get_redirect argument to categories() & templates()
Initial Comment: There is a need to add the "get_redirect" argument (from the "get()" method) to the "categories()", "templates()" and "templatesWithParams()" methods.
This allow for getting categories and templates links from redirect pages, because sometimes they use some. At least do we use a lot of those "categories in redirect pages" to categories acronyms at work into our intern mediawiki installation
Please see the attached patch that I made from the last available svn revision, which currently is r5491.
It is a "svn diff" as short as possible, only 6 lines modified in "wikipedia.py" : each time the add of the argument to the method ("get_redirect=False") then its use when calling the the get() method (get_redirect=get_redirect)
Please note that : * I added this "get_redirect" argument defaulted to "False"(ie. "get_redirect=False") because that way I am sure not to break anything elsewhere. It is up to you whereas to default it to "True" or not. * I added no comments about this new option, solely to reduce the "diff" file. Please let me know if its up to me to add the comment, then I will submit a new fully commented patch.
Best Regards, SRombauts
----------------------------------------------------------------------
Comment By: NicDumZ — Nicolas Dumazet (nicdumz)
Date: 2008-06-02 19:21
Message: Logged In: YES user_id=1963242 Originator: NO
Salut Sébastien ;)
I personally tend not to care about the size of the patch, if the size is induced by some comments : the more comments we have, the better it is ! And, yes, the fact that the added parameters defaulted to False was indeed appropriate here.
Something actually struck me reading your patch : Page::categories() already had a nofollow_redirects parameter that seemed to implement the behavior you were seeking. This lead me to some interesting findings in wikipedia.py. Somehow we were duplicating get_redirect with nofollow_redirects since... r2819 ! I implemented your suggestion, and removed the duplicate arguments in r5496 (Read more about it in the changelog here: http://fisheye.toolserver.org/changelog/pywikipedia/?cs=5496 )
Merci pour l'idée, n'hésite pas à revenir ;) -- Nicolas.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1981416...
pywikipedia-l@lists.wikimedia.org