Bugs item #1859078, was opened at 2007-12-27 21:07
Message generated for change (Comment added) made by nicdumz
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1859078&group_…
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: Nicolas Dumazet (nicdumz)
Assigned to: Nobody/Anonymous (nobody)
Summary: interwiki.py causing crash in wikipedia::removeLanguageLinks
Initial Comment:
Appeared to run correctly for a while, then :
Dump fr (wikipedia) saved
Traceback (most recent call last):
File "interwiki.py", line 1587, in <module>
bot.run()
File "interwiki.py", line 1364, in run
self.queryStep()
File "interwiki.py", line 1338, in queryStep
self.oneQuery()
File "interwiki.py", line 1334, in oneQuery
subject.workDone(self)
File "interwiki.py", line 707, in workDone
elif page.isEmpty() and not page.isCategory():
File "/home/nico/projets/pywikipedia/wikipedia.py", line 846, in isEmpty
txt = removeLanguageLinks(txt)
File "/home/nico/projets/pywikipedia/wikipedia.py", line 3019, in removeLanguageLinks
['nowiki', 'comment', 'math', 'pre'], marker=marker)
File "/home/nico/projets/pywikipedia/wikipedia.py", line 2795, in replaceExcept
import weblinkchecker
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
For the record, the exact command was :
python interwiki.py -autonomous -skipauto -start:!
Thanks,
Nicolas Dumazet.
----------------------------------------------------------------------
>Comment By: Nicolas Dumazet (nicdumz)
Date: 2007-12-27 21:48
Message:
Logged In: YES
user_id=1963242
Originator: YES
This is apparently a consequence of r4765, since reverting to r4764 is a
temporary fix.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1859078&group_…
Bugs item #1859078, was opened at 2007-12-27 21:07
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1859078&group_…
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: Nicolas Dumazet (nicdumz)
Assigned to: Nobody/Anonymous (nobody)
Summary: interwiki.py causing crash in wikipedia::removeLanguageLinks
Initial Comment:
Appeared to run correctly for a while, then :
Dump fr (wikipedia) saved
Traceback (most recent call last):
File "interwiki.py", line 1587, in <module>
bot.run()
File "interwiki.py", line 1364, in run
self.queryStep()
File "interwiki.py", line 1338, in queryStep
self.oneQuery()
File "interwiki.py", line 1334, in oneQuery
subject.workDone(self)
File "interwiki.py", line 707, in workDone
elif page.isEmpty() and not page.isCategory():
File "/home/nico/projets/pywikipedia/wikipedia.py", line 846, in isEmpty
txt = removeLanguageLinks(txt)
File "/home/nico/projets/pywikipedia/wikipedia.py", line 3019, in removeLanguageLinks
['nowiki', 'comment', 'math', 'pre'], marker=marker)
File "/home/nico/projets/pywikipedia/wikipedia.py", line 2795, in replaceExcept
import weblinkchecker
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 3: ordinal not in range(128)
For the record, the exact command was :
python interwiki.py -autonomous -skipauto -start:!
Thanks,
Nicolas Dumazet.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1859078&group_…
Patches item #1858181, was opened at 2007-12-26 03:17
Message generated for change (Comment added) made by rotemliss
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1858181&group_…
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: Purodha B Blissenbach (purodha)
Assigned to: Nobody/Anonymous (nobody)
Summary: weblinkcheker.py - ksh language update
Initial Comment:
Add ksh language to weblinkcheker.py
See attached patch file.
Thank you.
----------------------------------------------------------------------
Comment By: Rotem Liss (rotemliss)
Date: 2007-12-27 20:58
Message:
Logged In: YES
user_id=1327030
Originator: NO
Added in r4765.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1858181&group_…
Patches item #1857276, was opened at 2007-12-24 03:19
Message generated for change (Comment added) made by rotemliss
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1857276&group_…
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: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: ko support for featured.py
Initial Comment:
Please apply attached patch to featured.py.
comments/featured article support for ko - Korean. Thanks.
----------------------------------------------------------------------
Comment By: Rotem Liss (rotemliss)
Date: 2007-12-27 20:57
Message:
Logged In: YES
user_id=1327030
Originator: NO
Another translation was already added, from patch 1858530.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1857276&group_…
Revision: 4763
Author: rotem
Date: 2007-12-27 18:41:24 +0000 (Thu, 27 Dec 2007)
Log Message:
-----------
Making Page.templatesWithParams work for nested templates (in parameters): It was used to see the end of the nested template as the end of the main template. Now using markers to avoid that.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2007-12-27 13:51:12 UTC (rev 4762)
+++ trunk/pywikipedia/wikipedia.py 2007-12-27 18:41:24 UTC (rev 4763)
@@ -1546,23 +1546,53 @@
# remove commented-out stuff etc.
thistxt = removeDisabledParts(thistxt)
+ # marker for inside template
+ marker = '@@'
+ while marker in thistxt:
+ marker += '@'
+
result = []
- Rtemplate = re.compile(r'{{(msg:)?(?P<name>[^{\|]+?)(\|(?P<params>.+?))?}}', re.DOTALL)
- for m in Rtemplate.finditer(thistxt):
- paramString = m.group('params')
- params = []
- if paramString:
- params = paramString.split('|')
- name = m.group('name')
- if self.site().isInterwikiLink(name):
- continue
- try:
- name = Page(self.site(), name).title()
- except Error:
- output(u"Page %s contains invalid template name %s."
- % (self.title(), name))
- continue
- result.append((name, params))
+ markers = {}
+ count = 0
+ Rtemplate = re.compile(r'{{(msg:)?(?P<name>[^{\|]+?)(\|(?P<params>[^{]+?))?}}')
+ Rmarker = re.compile('%s(\\d+)%s' % (marker, marker))
+ while Rtemplate.search(thistxt) is not None:
+ for m in Rtemplate.finditer(thistxt):
+ # Make sure it is not detected again
+ count += 1
+ text = m.group()
+ markers[count] = text
+ thistxt = thistxt.replace(text, '%s%d%s' % (marker, count, marker))
+
+ # Name
+ name = m.group('name')
+ m2 = Rmarker.search(name)
+ if m2 is not None:
+ # Doesn't detect templates whose name is changing
+ continue
+ if self.site().isInterwikiLink(name):
+ continue
+ try:
+ name = Page(self.site(), name).title()
+ except Error:
+ output(u"Page %s contains invalid template name %s."
+ % (self.title(), name))
+ continue
+
+ # Parameters
+ paramString = m.group('params')
+ params = []
+ if paramString:
+ # Parse string
+ markedParams = paramString.split('|')
+ # Replace markers
+ for param in markedParams:
+ for m2 in Rmarker.finditer(param):
+ param = param.replace(m2.group(), markers[int(m2.group(1))])
+ params.append(param)
+
+ # Add it to the result
+ result.append((name, params))
return result
def getRedirectTarget(self):
Revision: 4762
Author: filnik
Date: 2007-12-27 13:51:12 +0000 (Thu, 27 Dec 2007)
Log Message:
-----------
Added a feature (-debug), added two messages, etc.
Modified Paths:
--------------
trunk/pywikipedia/blockpageschecker.py
Modified: trunk/pywikipedia/blockpageschecker.py
===================================================================
--- trunk/pywikipedia/blockpageschecker.py 2007-12-26 21:22:51 UTC (rev 4761)
+++ trunk/pywikipedia/blockpageschecker.py 2007-12-27 13:51:12 UTC (rev 4762)
@@ -9,6 +9,9 @@
Parameters:
-always Doesn't ask every time if the bot should make the change or not, do it always.
+-debug When the bot can't delete the template from the page (wrong regex or something like that)
+ it will ask you if it should open the page on your browser.
+ (attention: pages included may give false positives..)
-page Work only on one page
Note: This script uses also genfactory, you can use those generator as default.
@@ -20,6 +23,10 @@
If you have problems, ask on botwiki ( http://botwiki.sno.cc )
or on IRC (#pywikipediabot)
+--- FixME ---
+If the page was protected to sysop and now is protected to autoconfirmed users,
+the bot won't change the template. Should this be "fixed"?
+
--- Example of how to use the script ---
python blockpageschecker.py -always
@@ -36,7 +43,7 @@
__version__ = '$Id: blockpageschecker.py,v 1.1 2007/12/7 19.23.00 filnik Exp$'
#
-import re
+import re, webbrowser
import wikipedia, catlib, pagegenerators, config
#######################################################
@@ -51,7 +58,9 @@
r'\{\{(?:[Tt]emplate:|[Mm]odèle:|)(?:[Pp]age|[Aa]rchive|[Mm]odèle) protégée?\}\}',
r'\{\{(?:[Tt]emplate:|[Mm]odèle:|)[Ss]emi[- ]?protection\}\}'
],
- 'it':[r'{\{(?:[Tt]emplate:|)[Aa]vvisobloccoparziale(?:|[ _]scad\|(.*?))\}\}', r'{\{(?:[Tt]emplate:|)[Aa]vvisoblocco(?:|[ _]scad\|(?:.*?))\}\}'],
+ 'it':[r'{\{(?:[Tt]emplate:|)[Aa]vvisobloccoparziale(?:|[ _]scad\|.*?|\|.*?)\}\}',
+ r'{\{(?:[Tt]emplate:|)[Aa]vvisoblocco(?:|[ _]scad\|(?:.*?))\}\}',
+ r'{\{(?:[Tt]emplate:|)[Aa]bp(?:|[ _]scad\|(?:.*?))\}\}'],
'ja':[r'\{\{(?:[Tt]emplate:|)(?:半|移動|移動半|)保護(?:S|)\}\}',],
'zh':[r'\{\{(?:[Tt]emplate:|)Protected(?:\|*)\}\}',r'\{\{(?:[Tt]emplate:|)Mini-protected(?:\|*)\}\}',
r'\{\{(?:[Tt]emplate:|)Protected logo(?:\|*)\}\}'],
@@ -88,13 +97,15 @@
wikipedia.output(u"Your project is not supported by this script. You have to edit the script and add it!")
wikipedia.stopme()
# always, define a generator to understand if the user sets one, defining what's genFactory
- always = False; generator = False; genFactory = pagegenerators.GeneratorFactory()
+ always = False; generator = False; debug = False; genFactory = pagegenerators.GeneratorFactory()
# To prevent Infinite loops
errorCount = 0
# Loading the default options.
for arg in wikipedia.handleArgs():
if arg == '-always':
always = True
+ if arg == '-debug':
+ debug = True
elif arg.startswith('-page'):
if len(arg) == 5:
generator = [wikipedia.Page(wikipedia.getSite(), wikipedia.input(u'What page do you want to use?'))]
@@ -110,6 +121,7 @@
commentUsed = wikipedia.translate(site, comment)
if not generator:
generator = list()
+ wikipedia.output(u'Loading categories...')
# Define the category if no other generator has been setted
for CAT in category:
cat = catlib.Category(site, CAT)
@@ -117,6 +129,7 @@
gen = pagegenerators.CategorizedPageGenerator(cat)
for pageCat in gen:
generator.append(pageCat)
+ wikipedia.output(u'Categories loaded, start!')
# Main Loop
for page in generator:
pagename = page.title()
@@ -127,8 +140,10 @@
(text, useless, editRestriction) = page._getEditPage()
except wikipedia.NoPage:
wikipedia.output("%s doesn't exist! Skipping..." % pagename)
+ continue
except wikipedia.IsRedirectPage:
wikipedia.output("%s is a redirect! Skipping..." % pagename)
+ continue
if editRestriction == 'sysop':
wikipedia.output(u'The page is protected to the sysop, skipping...')
continue
@@ -184,6 +199,22 @@
# Break only if the errors are one after the other
errorCount = 0
break
+ else:
+ wikipedia.output(u'No changes! Strange! Check the regex!')
+ if debug == True:
+ quest = wikipedia.input(u'Do you want to open the page on your browser? [Y]es, [N]o: ')
+ pathWiki = site.family.nicepath(site.lang)
+ url = 'http://%s%s%s' % (wikipedia.getSite().hostname(), pathWiki, page.urlname())
+ while 1:
+ if quest.lower() in ['y', 'yes']:
+ webbrowser.open(url)
+ break
+ elif quest.lower() in ['n', 'no']:
+ break
+ else:
+ wikipedia.output(u'wrong entry, type "yes" or "no"')
+ continue
+
if __name__ == "__main__":
try:
main()
Patches item #1858530, was opened at 2007-12-26 18:59
Message generated for change (Comment added) made by alleborgo
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1858530&group_…
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: Alex S.H. Lin (lin4h)
Assigned to: Nobody/Anonymous (nobody)
Summary: Update messages (zh,ja,th,ko)
Initial Comment:
as title
----------------------------------------------------------------------
Comment By: Alleborgo (alleborgo)
Date: 2007-12-26 20:10
Message:
Logged In: YES
user_id=1898409
Originator: NO
Committed in r4760. Thanks for giving patch.
----------------------------------------------------------------------
Comment By: Alex S.H. Lin (lin4h)
Date: 2007-12-26 19:11
Message:
Logged In: YES
user_id=1902991
Originator: YES
File Added: messageup.patch
----------------------------------------------------------------------
Comment By: Alex S.H. Lin (lin4h)
Date: 2007-12-26 19:06
Message:
Logged In: YES
user_id=1902991
Originator: YES
File Added: messageup.patch
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1858530&group_…