Revision: 6215 Author: misza13 Date: 2009-01-01 20:23:52 +0000 (Thu, 01 Jan 2009)
Log Message: ----------- Added two new options to block() function: -watch user's user and user talk pages (default: False) -allow user to edit own talk page when blocked (default: True) Also cleaned up some debug statements.
Modified Paths: -------------- trunk/pywikipedia/userlib.py
Modified: trunk/pywikipedia/userlib.py =================================================================== --- trunk/pywikipedia/userlib.py 2008-12-31 10:41:23 UTC (rev 6214) +++ trunk/pywikipedia/userlib.py 2009-01-01 20:23:52 UTC (rev 6215) @@ -97,7 +97,7 @@ else: break
- def block(self, expiry=None, reason=None, anonOnly=True, noSignup=False, enableAutoblock=False, emailBan=False): + def block(self, expiry=None, reason=None, anonOnly=True, noSignup=False, enableAutoblock=False, emailBan=False, watchUser=False, allowUsertalk=True): """ Block the user.
@@ -109,6 +109,8 @@ noSignup - does the block disable account creation? enableAutoblock - is autoblock enabled on the block? emailBan - prevent user from sending e-mail? + watchUser - watch the user's user and talk pages? + allowUsertalk - allow this user to edit own talk page?
The default values for block options are set to as most unrestrictive """ @@ -136,6 +138,8 @@ 'wpCreateAccount': boolStr[noSignup], 'wpEnableAutoblock': boolStr[enableAutoblock], 'wpEmailBan': boolStr[emailBan], + 'wpWatchUser': boolStr[watchUser], + 'wpAllowUsertalk': boolStr[allowUsertalk], 'wpBlock': 'Block this user', 'wpEditToken': token } @@ -173,7 +177,7 @@ data = self.site.getUrl(address) bIDre = re.search(r'action=unblock&id=(\d+)', data) if not bIDre: - print data + wikipedia.output(data) raise BlockIDError
return bIDre.group(1) @@ -207,8 +211,8 @@ try: Site = wikipedia.getSite() exampleUser = User(Site, 'Example') - print exampleUser.getUserPage().get() - print exampleUser.getUserPage('Lipsum').get() - print exampleUser.getUserTalkPage().get() + wikipedia.output(exampleUser.getUserPage().get()) + wikipedia.output(exampleUser.getUserPage('Lipsum').get()) + wikipedia.output(exampleUser.getUserTalkPage().get()) finally: wikipedia.stopme()
pywikipedia-l@lists.wikimedia.org