Its better to make a bug request at sourceForge [1]. I guess it is not easy to 
fix so its better to use the bug tracker. 

Greetings
xqt

[1] https://sourceforge.net/tracker/?group_id=93107&atid=603138


----- Original Nachricht ----
Von:     "Tuszynski, Jaroslaw W." <[email protected]>
An:      Pywikipedia discussion list <[email protected]>
Datum:   24.10.2011 18:37
Betreff: [Pywikipedia-l] Problems with Page.templatesWithParams function

> Hi I am still quite new to pywikipediabot framework, so excuse me if my
> issue is trivial. I am writing some code for maintenance of pages in
> Creator namespace on Commons and I run into a weird problem with
> Page.templatesWithParams function. The function is apparently not able
> to handle template parameters, like "{{{1|}}}". For example I run the
> following code:
> 
> #!/usr/bin/python
> # -*- coding: utf-8  -*-
> 
> import sys, string
> sys.path.append("C:/Programs/pywikipedia/")
> import wikipedia
> 
> if __name__ == "__main__":
>     site = wikipedia.getSite(u'commons', u'commons')
>     page = wikipedia.Page(site, u'Creator:Ansel Adams')
>     wikipedia.output(u'Original page text:\n'+page.get()+u'\n\nTemplates
> detected by templatesWithParams:')
>     for template in page.templatesWithParams():       
>       wikipedia.output(u'template[0]="%s"' % template[0])
> 
>     thistxt = string.replace(page.get(), '{{{1|}}}', '')
>     wikipedia.output(u'\nModified page text:\n'+thistxt+u'\n\nTemplates
> detected by templatesWithParams:')
>     for template in page.templatesWithParams(thistxt):        
>       wikipedia.output(u'template[0]="%s"' % template[0])
>     
> 
> 
> and got the following output:
> Original page text:
> {{Creator
>  | Image             = Ansel_Adams_and_camera.jpg
>  | ImgWidth          = 120
>  | Name              = Ansel Adams
>  | Alternative names = Ansel Easton Adams
>  | Sortkey           = Adams, Ansel
>  | Nationality       = US
>  | Gender            = male
>  | Occupation        = photographer 
>  | Description       = 
>  | Birthdate         = 1902-02-20
>  | Birthloc          = {{San Francisco}}
>  | Deathdate         = 1984-04-22
>  | Deathloc          = Monterey
>  | Workperiod        = 
>  | Workloc           = American West
>  | Homecat           = Ansel Adams
>  | Option            = {{{1|}}}
>  | Authority         = {{Authority
> control|PND=11881303X|LCCN=n/79/56359|VIAF=61625857|ARC=1332556|bare=1}}
> }}
> 
> Templates detected by templatesWithParams:
> template[0]="San Francisco"
> template[0]="1"
> template[0]="Authority control"
> 
> Modified page text:
> {{Creator
>  | Image             = Ansel_Adams_and_camera.jpg
>  | ImgWidth          = 120
>  | Name              = Ansel Adams
>  | Alternative names = Ansel Easton Adams
>  | Sortkey           = Adams, Ansel
>  | Nationality       = US
>  | Gender            = male
>  | Occupation        = photographer 
>  | Description       = 
>  | Birthdate         = 1902-02-20
>  | Birthloc          = {{San Francisco}}
>  | Deathdate         = 1984-04-22
>  | Deathloc          = Monterey
>  | Workperiod        = 
>  | Workloc           = American West
>  | Homecat           = Ansel Adams
>  | Option            = 
>  | Authority         = {{Authority
> control|PND=11881303X|LCCN=n/79/56359|VIAF=61625857|ARC=1332556|bare=1}}
> }}
> 
> Templates detected by templatesWithParams:
> template[0]="San Francisco"
> template[0]="Authority control"
> template[0]="Creator"
> 
> As one can see in the first case the function was not able to find
> "Creator" template, and was only able to do so after deletion of
> "{{{1|}}}".
> 
> Is this a feature or a bug? Or in other words, am I misusing the
> function somehow and there is some way to get it to work correctly, or
> is it a bug that should be reported somewhere, so it can be fixed?
> 
> Jarek T.
> (user:jarekt)
> 
> _______________________________________________
> 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

Reply via email to