Revision: 5150 Author: filnik Date: 2008-03-21 21:06:51 +0000 (Fri, 21 Mar 2008)
Log Message: ----------- Patch by harriv - adding functionality
Modified Paths: -------------- trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py =================================================================== --- trunk/pywikipedia/wikipedia.py 2008-03-21 20:06:36 UTC (rev 5149) +++ trunk/pywikipedia/wikipedia.py 2008-03-21 21:06:51 UTC (rev 5150) @@ -1572,17 +1572,20 @@ """ return [template for (template, param) in self.templatesWithParams()]
- def templatesWithParams(self): + def templatesWithParams(self, thistxt=None): """Return a list of templates used on this Page.
Return value is a list of tuples. There is one tuple for each use of a template in the page, with the template title as the first entry and a list of parameters as the second entry. + + If thistxt is set, it is used instead of current page content. """ - try: - thistxt = self.get() - except (IsRedirectPage, NoPage): - return [] + if not thistxt: + try: + thistxt = self.get() + except (IsRedirectPage, NoPage): + return []
# remove commented-out stuff etc. thistxt = removeDisabledParts(thistxt)