Revision: 8230
Author: dantman
Date: 2010-05-30 06:31:54 +0000 (Sun, 30 May 2010)
Log Message:
-----------
Fix bug where pywikipedia starts sending cookies with bad \r's inside them causing php to respond with HTTP 400 errors where pywikipedia ends up reporting errors that are nearly impossible to debug.
\r's appear to have been inserted into login-data by older versions of pywikipedia, so lack of degrading for this causes incompatibility with data when someone tries to upgrade.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2010-05-29 11:02:47 UTC (rev 8229)
+++ trunk/pywikipedia/wikipedia.py 2010-05-30 06:31:54 UTC (rev 8230)
@@ -4787,7 +4787,7 @@
"""read login cookie file and return a dictionary."""
try:
f = open( config.datafilepath('login-data', filename), 'r')
- ck = re.compile("(.*?)=(.*?)\n")
+ ck = re.compile("(.*?)=(.*?)\r?\n")
data = dict([(x[0],x[1]) for x in ck.findall(f.read())])
#data = dict(ck.findall(f.read()))
f.close()
Revision: 8229
Author: xqt
Date: 2010-05-29 11:02:47 +0000 (Sat, 29 May 2010)
Log Message:
-----------
show scripts options from pagegenewrators (bugfix for #3008448), use -page from pagegenerators lib
Modified Paths:
--------------
trunk/pywikipedia/fixing_redirects.py
Modified: trunk/pywikipedia/fixing_redirects.py
===================================================================
--- trunk/pywikipedia/fixing_redirects.py 2010-05-28 17:32:37 UTC (rev 8228)
+++ trunk/pywikipedia/fixing_redirects.py 2010-05-29 11:02:47 UTC (rev 8229)
@@ -5,9 +5,10 @@
links in featured pages or only one page of each wiki.
Can be using with:
--featured Run over featured pages
--page:XXX Run over only one page
+¶ms;
+-featured Run over featured pages
+
Run fixing_redirects.py -help to see all the command-line
options -file, -ref, -links, ...
@@ -186,7 +187,6 @@
def main():
start = '!'
featured = False
- title = None
namespace = None
gen = None
@@ -198,11 +198,6 @@
for arg in wikipedia.handleArgs():
if arg == '-featured':
featured = True
- elif arg.startswith('-page'):
- if len(arg) == 5:
- title = wikipedia.input(u'Which page should be processed?')
- else:
- title = arg[6:]
elif arg.startswith('-namespace'):
if len(arg) == 10:
namespace = int(wikipedia.input(u'Which namespace should be processed?'))
@@ -226,9 +221,6 @@
generator = pagegenerators.NamespaceFilterPageGenerator(gen, [0])
for page in generator:
workon(page)
- elif title is not None:
- page = wikipedia.Page(wikipedia.getSite(), title)
- workon(page)
elif namespace is not None:
for page in pagegenerators.AllpagesPageGenerator(start=start, namespace=namespace, includeredirects=False):
workon(page)
Revision: 8228
Author: xqt
Date: 2010-05-28 17:32:37 +0000 (Fri, 28 May 2010)
Log Message:
-----------
update fixes.py from trunk
Modified Paths:
--------------
branches/rewrite/scripts/fixes.py
trunk/pywikipedia/fixes.py
Modified: branches/rewrite/scripts/fixes.py
===================================================================
--- branches/rewrite/scripts/fixes.py 2010-05-28 17:18:45 UTC (rev 8227)
+++ branches/rewrite/scripts/fixes.py 2010-05-28 17:32:37 UTC (rev 8228)
@@ -5,7 +5,7 @@
"""
#
-# (C) Pywikipedia team, 2008-2009
+# (C) Pywikipedia team, 2008-2010
#
__version__ = '$Id$'
#
@@ -13,23 +13,27 @@
#
help = u"""
- * HTML - Convert HTML tags to wiki syntax, and
- fix XHTML.
- * isbn - Fix badly formatted ISBNs.
- * syntax - Try to fix bad wiki markup. Do not run
- this in automatic mode, as the bot may
- make mistakes.
- * syntax-safe - Like syntax, but less risky, so you can
- run this in automatic mode.
- * case-de - fix upper/lower case errors in German
- * grammar-de - fix grammar and typography in German
- * vonbis - Ersetze Binde-/Gedankenstrich durch "bis" in German
- * music - Links auf Begriffsklärungen in German
- * datum - specific date formats in German
- * correct-ar - Corrections for Arabic Wikipedia and any Arabic wiki.
- * yu-tld - the yu top-level domain will soon be disabled, see
- * fckeditor - Try to convert FCKeditor HTML tags to wiki syntax.
- http://lists.wikimedia.org/pipermail/wikibots-l/2009-February/000290.html
+ * HTML - Convert HTML tags to wiki syntax, and
+ fix XHTML.
+ * isbn - Fix badly formatted ISBNs.
+ * syntax - Try to fix bad wiki markup. Do not run
+ this in automatic mode, as the bot may
+ make mistakes.
+ * syntax-safe - Like syntax, but less risky, so you can
+ run this in automatic mode.
+ * case-de - fix upper/lower case errors in German
+ * grammar-de - fix grammar and typography in German
+ * vonbis - Ersetze Binde-/Gedankenstrich durch "bis"
+ in German
+ * music - Links auf Begriffsklärungen in German
+ * datum - specific date formats in German
+ * correct-ar - Corrections for Arabic Wikipedia and any
+ Arabic wiki.
+ * yu-tld - the yu top-level domain will soon be
+ disabled, see
+ * fckeditor - Try to convert FCKeditor HTML tags to wiki
+ syntax.
+ http://lists.wikimedia.org/pipermail/wikibots-l/2009-February/000290.html
"""
@@ -44,6 +48,7 @@
'cs':u'převod/oprava HTML',
'en':u'Robot: Converting/fixing HTML',
'eo':u'Bot: koredtado de HTMLa teksto',
+ 'fa':u'ربات:تصحیح/فیکس کدهای اچتیامال',
'de':u'Bot: konvertiere/korrigiere HTML',
'fr':u'Robot: convertit/fixe HTML',
'he':u'בוט: ממיר/מתקן HTML',
@@ -185,6 +190,7 @@
'de':u'Bot: Korrigiere Wiki-Syntax',
'en':u'Bot: Fixing wiki syntax',
'eo':u'Bot: Korektado de vikia sintakso',
+ 'fa':u'ربات:تصحیح قالب ویکینویسی',
'fr':u'Bot: Corrige wiki-syntaxe',
'he':u'בוט: מתקן תחביר ויקי',
'ia':u'Robot: Reparation de syntaxe wiki',
@@ -260,6 +266,7 @@
'de':u'Bot: Korrigiere Wiki-Syntax',
'en':u'Bot: Fixing wiki syntax',
'eo':u'Bot: Korektado de vikia sintakso',
+ 'fa':u'ربات:تصحیح قالب ویکینویسی',
'fr':u'Bot: Corrige wiki-syntaxe',
'he':u'בוט: מתקן תחביר ויקי',
'ia':u'Robot: Reparation de syntaxe wiki',
@@ -416,6 +423,7 @@
'en': u'Robot: Fixing ISBN format',
'es': u'Arreglando formato ISBN',
'eo': u'Bot: Korekto de teksto en ISBN-formato',
+ 'fa': u'ربات:تصحیح شابک',
'he': u'בוט: מתקן פורמט ISBN',
'ja': u'ロボットによる: ISBNフォーマット修正',
'ru': u'Бот: Коррекция ISBN формата',
@@ -637,7 +645,7 @@
},
# These replacements will convert HTML tag from FCK-editor to wiki syntax.
#
- 'fckeditor': {
+ 'fckeditor': {
'regex': True,
'msg': {
'en': u'Robot: Fixing rich-editor html',
@@ -645,8 +653,8 @@
'replacements': [
# replace <br> with a new line
(r'(?i)<br>', r'\n'),
- # replace with a space
- (r'(?i) ', r' '),
+ # replace with a space
+ (r'(?i) ', r' '),
],
},
}
Modified: trunk/pywikipedia/fixes.py
===================================================================
--- trunk/pywikipedia/fixes.py 2010-05-28 17:18:45 UTC (rev 8227)
+++ trunk/pywikipedia/fixes.py 2010-05-28 17:32:37 UTC (rev 8228)
@@ -5,7 +5,7 @@
"""
#
-# (C) Pywikipedia team, 2008-2009
+# (C) Pywikipedia team, 2008-2010
#
__version__ = '$Id$'
#
@@ -37,7 +37,7 @@
* fckeditor - Try to convert FCKeditor HTML tags to wiki
syntax.
http://lists.wikimedia.org/pipermail/wikibots-l/2009-February/000290.html
-
+
**) NOTE: these fixes are part of the
cosmetic_changes.py. You may use
that script instead.