Bugs item #1949476, was opened at 2008-04-23 05:09
Message generated for change (Comment added) made by russblau
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=194947…
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: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: NicDumZ — Nicolas Dumazet (nicdumz)
Assigned to: Nobody/Anonymous (nobody)
Summary: PreloadingGenerator does not set
editRestriction
Initial Comment:
I realized that sometimes, in blockpageschecker.py, someTotalProtectedPage.canBeEdited()
would wrongly return True (I have no sysop account, hence on every [edit=sysop] protected
page, it should return False)
I first tried the single canBeEdited() on that total protected page :
>> import wikipedia; s =
wikipedia.Site('fr', 'wikipedia'); protectedpage = wikipedia.Page(s,
'Zentrum')
Checked for running processes. 1 processes currently running,
including the current process.
>> protectedpage.canBeEdited()
Getting 1
pages from wikipedia:fr...
False
Which is fine.
However :
>> import wikipedia; s =
wikipedia.Site('fr', 'wikipedia'); protectedpage = wikipedia.Page(s,
'Zentrum')
Checked for running processes. 1 processes currently running,
including the current process.
>> import pagegenerators; gen =
pagegenerators.PreloadingGenerator([protectedpage])
>> for p in gen : print p.canBeEdited()
...
Getting 1 pages from wikipedia:fr...
True
>> protectedpage.canBeEdited()
True
Which is wrong.
I then thought then calling canBeEdited on a total protected page from PreloadingGenerator
would _every_time_ return wrongly True, but I was wrong :
>> import wikipedia; s =
wikipedia.Site('en', 'wikipedia'); protectedpage = wikipedia.Page(s,
'Wikipedia:site support')
Checked for running processes. 1 processes
currently running, including the current process.
>> import pagegenerators; gen =
pagegenerators.PreloadingGenerator([protectedpage])
>> for p in gen : print p.canBeEdited()
...
Getting 1 pages from wikipedia:en...
False
So apparently, in some special cases, calling canBeEdited on a total protected page from
PreloadingGenerator returns True. However I have not been able to find *when* exactly this
happens.
Any thoughts ?
PS : An easy fix for this is to get rid of the current implementation of canBeEdited, to
use instead the new getRestrictions using the API (getRestrictions()['edit']). But
we should find out what is happenning here, since we might miss something important.
----------------------------------------------------------------------
Comment By: Russell Blau (russblau)
Date:
2008-04-23 10:47
Message:
Logged In: YES
user_id=855050
Originator: NO
The reason for this is that PreloadingGenerator calls wikipedia.getAll(),
which uses the wiki's [[Special:Export]] page to retrieve the page(s); the
data structure returned by [[Special:Export]] does not include the
protection status, so it is impossible to determine whether a preloaded
page is protected. The only way I can see to fix this within the existing
framework is to have canBeEdited() call self.get(force=True) instead of
just self.get(), but that would completely defeat the purpose of preloading
the pages. The other alternative is your suggestion of using the API, but
this would break backwards-compatibility for many wiki families, and I
think that is better addressed in the rewrite branch.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=194947…