[Pywikipedia-l] SVN: [5464] trunk/pywikipedia
rotem at svn.wikimedia.org
rotem at svn.wikimedia.org
Thu May 29 14:15:13 UTC 2008
Revision: 5464
Author: rotem
Date: 2008-05-29 14:15:13 +0000 (Thu, 29 May 2008)
Log Message:
-----------
Remove trailing whitespace.
Modified Paths:
--------------
trunk/pywikipedia/families/wikipedia_family.py
trunk/pywikipedia/family.py
trunk/pywikipedia/login.py
trunk/pywikipedia/wikipedia.py
trunk/pywikipedia/xmlreader.py
Modified: trunk/pywikipedia/families/wikipedia_family.py
===================================================================
--- trunk/pywikipedia/families/wikipedia_family.py 2008-05-29 14:04:25 UTC (rev 5463)
+++ trunk/pywikipedia/families/wikipedia_family.py 2008-05-29 14:15:13 UTC (rev 5464)
@@ -547,7 +547,7 @@
'fa': [u'ابهامزدایی'],
'fi': [u'Täsmennyssivu', u'Disambig'],
'fo': [u'Fleiri týdningar'],
- # See http://fr.wikipedia.org/wiki/MediaWiki:Disambiguationspage
+ # See http://fr.wikipedia.org/wiki/MediaWiki:Disambiguationspage
'fr': [u'Homonymie', u'Arrondissements homonymes', u'Disambig',
u'Bandeau standard pour page d\'homonymie',
u'Batailles homonymes', u'Cantons homonymes',
Modified: trunk/pywikipedia/family.py
===================================================================
--- trunk/pywikipedia/family.py 2008-05-29 14:04:25 UTC (rev 5463)
+++ trunk/pywikipedia/family.py 2008-05-29 14:15:13 UTC (rev 5464)
@@ -40,7 +40,7 @@
]
self.langs = {}
-
+
# The timedelta to GMT of the server.
# Exemple for a server running CET :
# timedelta(hours=+1)
Modified: trunk/pywikipedia/login.py
===================================================================
--- trunk/pywikipedia/login.py 2008-05-29 14:04:25 UTC (rev 5463)
+++ trunk/pywikipedia/login.py 2008-05-29 14:15:13 UTC (rev 5464)
@@ -93,7 +93,7 @@
return True
return False
else:
- # No bot policies on other
+ # No bot policies on other
return True
def getCookie(self, remember=True, captchaId = None, captchaAnswer = None):
@@ -120,7 +120,7 @@
if self.site.hostname() in config.authenticate.keys():
headers = {
- "Content-type": "application/x-www-form-urlencoded",
+ "Content-type": "application/x-www-form-urlencoded",
"User-agent": wikipedia.useragent
}
data = self.site.urlEncode(predata)
@@ -182,10 +182,10 @@
def readPassword(self):
"""
- Reads passwords from a file. DO NOT FORGET TO REMOVE READ
+ Reads passwords from a file. DO NOT FORGET TO REMOVE READ
ACCESS FOR OTHER USERS!!! Use chmod 600 password-file.
- All lines below should be valid Python tuples in the form
- (code, family, username, password) or (username, password)
+ All lines below should be valid Python tuples in the form
+ (code, family, username, password) or (username, password)
to set a default password for an username. Default usernames
should occur above specific usernames.
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2008-05-29 14:04:25 UTC (rev 5463)
+++ trunk/pywikipedia/wikipedia.py 2008-05-29 14:15:13 UTC (rev 5464)
@@ -3350,7 +3350,7 @@
insite = getSite()
if not links:
return ''
-
+
ar = interwikiSort(links.keys(), insite)
s = []
for site in ar:
@@ -3365,7 +3365,7 @@
sep = u'\r\n'
s=sep.join(s) + u'\r\n'
return s
-
+
# Sort sites according to local interwiki sort logic
def interwikiSort(sites, insite = None):
if insite is None:
@@ -3390,9 +3390,9 @@
sites = firstsites + sites
if insite.interwiki_putfirst_doubled(sites): #some implementations return False
sites = insite.interwiki_putfirst_doubled(sites) + sites
-
+
return sites
-
+
# Wikitext manipulation functions dealing with category links
def getCategoryLinks(text, site):
import catlib
@@ -4465,12 +4465,12 @@
u"Retrieving mediawiki messages from Special:Allmessages")
elementtree = True
try:
- try:
- from xml.etree.cElementTree import XML # 2.5
- except ImportError:
- try:
- from cElementTree import XML
- except ImportError:
+ try:
+ from xml.etree.cElementTree import XML # 2.5
+ except ImportError:
+ try:
+ from cElementTree import XML
+ except ImportError:
from elementtree.ElementTree import XML
except ImportError:
if verbose:
@@ -4480,7 +4480,7 @@
retry_idle_time = 1
while True:
get_throttle()
- xml = self.getUrl(self.get_address("Special:Allmessages")
+ xml = self.getUrl(self.get_address("Special:Allmessages")
+ "&ot=xml")
# xml structure is :
# <messages lang="fr">
@@ -4489,14 +4489,14 @@
# </messages>
if elementtree:
decode = xml.encode(self.encoding())
- tree = XML(decode)
- self._mediawiki_messages = dict([(tag.get('name').lower(), tag.text)
+ tree = XML(decode)
+ self._mediawiki_messages = dict([(tag.get('name').lower(), tag.text)
for tag in tree.getiterator('message')])
else:
tree = BeautifulStoneSoup(xml)
- self._mediawiki_messages = dict([(tag.get('name').lower(), tag.string)
+ self._mediawiki_messages = dict([(tag.get('name').lower(), tag.string)
for tag in tree.findAll('message')])
-
+
if not self._mediawiki_messages:
# No messages could be added.
# We assume that the server is down.
@@ -5033,8 +5033,8 @@
url = self.protectedpages_address()
url += '&type=%s&level=%s' % (type, lvl)
if namespace != None: # /!\ if namespace seems simpler, but returns false when ns=0
-
- url += '&namespace=%s' % namespace
+
+ url += '&namespace=%s' % namespace
parser_text = self.getUrl(url)
while 1:
#<li><a href="/wiki/Pagina_principale" title="Pagina principale">Pagina principale</a> <small>(6.522 byte)</small> (protetta)</li>
@@ -5088,7 +5088,6 @@
cache.append(title)
yield Page(self, title)
offset += limit
-
def __repr__(self):
return self.family.name+":"+self.lang
Modified: trunk/pywikipedia/xmlreader.py
===================================================================
--- trunk/pywikipedia/xmlreader.py 2008-05-29 14:04:25 UTC (rev 5463)
+++ trunk/pywikipedia/xmlreader.py 2008-05-29 14:15:13 UTC (rev 5464)
@@ -188,9 +188,9 @@
if self.destination == 'text':
self.text += data
elif self.destination == 'id':
- self.id += data
+ self.id += data
elif self.destination == 'revisionid':
- self.revisionid += data
+ self.revisionid += data
elif self.destination == 'restrictions':
self.restrictions += data
elif self.destination == 'title':
More information about the Pywikipedia-l
mailing list