Bugs item #2309005, was opened at 2008-11-18 16:31
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=2309005&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: other
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Linar Khalitov (rubin16)
Assigned to: Nobody/Anonymous (nobody)
Summary: welcome.py
Initial Comment:
# The page where the bot reads the real-time whitelist page.
# (this parameter is optional).
whitelist_pg = {
< ...>
'ru':u'LatitudeBot/Белый ÑпиÑок',
}
------------
change u'LatitudeBot to u'User:LatitudeBot.
This is more correct I suppose
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2309005&group_…
Revision: 6105
Author: russblau
Date: 2008-11-17 20:18:33 +0000 (Mon, 17 Nov 2008)
Log Message:
-----------
fix treatment of positional parameters to match MediaWiki's
Modified Paths:
--------------
branches/rewrite/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/textlib.py
===================================================================
--- branches/rewrite/pywikibot/textlib.py 2008-11-17 19:48:45 UTC (rev 6104)
+++ branches/rewrite/pywikibot/textlib.py 2008-11-17 20:18:33 UTC (rev 6105)
@@ -569,8 +569,11 @@
Return value is a list of tuples. There is one tuple for each use of a
template in the page, with the template title as the first entry and a
- dict of parameters as the second entry. Positional parameters are
- indexed by an int, named parameters by a str.
+ dict of parameters as the second entry. Parameters are indexed by
+ strings; as in MediaWiki, an unnamed parameter is given a parameter name
+ with an integer value corresponding to its position among the unnnamed
+ parameters, and if this results multiple parameters with the same name
+ only the last value provided will be returned.
"""
# remove commented-out stuff etc.
@@ -653,7 +656,7 @@
if "=" in param:
param_name, param_val = param.split("=", 1)
else:
- param_name = numbered_param
+ param_name = unicode(numbered_param)
param_val = param
numbered_param += 1
for m2 in Rmarker.finditer(param_val):
Revision: 6104
Author: russblau
Date: 2008-11-17 19:48:45 +0000 (Mon, 17 Nov 2008)
Log Message:
-----------
port of templates_with_parameters method from wikipedia.py
Modified Paths:
--------------
branches/rewrite/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/textlib.py
===================================================================
--- branches/rewrite/pywikibot/textlib.py 2008-11-16 11:53:14 UTC (rev 6103)
+++ branches/rewrite/pywikibot/textlib.py 2008-11-17 19:48:45 UTC (rev 6104)
@@ -564,3 +564,110 @@
linkR = re.compile(regex)
return linkR
+def extract_templates_and_params(text, get_redirect=False):
+ """Return list of template calls found in text.
+
+ Return value is a list of tuples. There is one tuple for each use of a
+ template in the page, with the template title as the first entry and a
+ dict of parameters as the second entry. Positional parameters are
+ indexed by an int, named parameters by a str.
+
+ """
+ # remove commented-out stuff etc.
+ thistxt = removeDisabledParts(text)
+
+ # marker for inside templates or parameters
+ marker = u'@@'
+ while marker in thistxt:
+ marker += u'@'
+
+ # marker for links
+ marker2 = u'##'
+ while marker2 in thistxt:
+ marker2 += u'#'
+
+ # marker for math
+ marker3 = u'%%'
+ while marker2 in thistxt:
+ marker3 += u'%'
+
+ result = []
+ inside = {}
+ count = 0
+ Rtemplate = re.compile(
+ ur'{{(msg:)?(?P<name>[^{\|]+?)(\|(?P<params>[^{]+?))?}}')
+ Rlink = re.compile(ur'\[\[[^\]]+\]\]')
+ Rmath = re.compile(ur'<math>[^<]+</math>')
+ Rmarker = re.compile(ur'%s(\d+)%s' % (marker, marker))
+ Rmarker2 = re.compile(ur'%s(\d+)%s' % (marker2, marker2))
+ Rmarker3 = re.compile(ur'%s(\d+)%s' % (marker3, marker3))
+
+ # Replace math with markers
+ maths = {}
+ count = 0
+ for m in Rmath.finditer(thistxt):
+ count += 1
+ text = m.group()
+ thistxt = thistxt.replace(text, '%s%d%s' % (marker3, count, marker3))
+ maths[count] = text
+
+ 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()
+ thistxt = thistxt.replace(text,
+ '%s%d%s' % (marker, count, marker))
+ # Make sure stored templates don't contain markers
+ for m2 in Rmarker.finditer(text):
+ text = text.replace(m2.group(), inside[int(m2.group(1))])
+ for m2 in Rmarker3.finditer(text):
+ text = text.replace(m2.group(), maths[int(m2.group(1))])
+ inside[count] = text
+
+ # Name
+ name = m.group('name').strip()
+ m2 = Rmarker.search(name) or Rmath.search(name)
+ if m2 is not None:
+ # Doesn't detect templates whose name changes,
+ # or templates whose name contains math tags
+ continue
+ # Parameters
+ paramString = m.group('params')
+ params = {}
+ numbered_param = 1
+ if paramString:
+ # Replace links to markers
+ links = {}
+ count2 = 0
+ for m2 in Rlink.finditer(paramString):
+ count2 += 1
+ text = m2.group()
+ paramString = paramString.replace(text,
+ '%s%d%s' % (marker2, count2, marker2))
+ links[count2] = text
+ # Parse string
+ markedParams = paramString.split('|')
+ # Replace markers
+ for param in markedParams:
+ if "=" in param:
+ param_name, param_val = param.split("=", 1)
+ else:
+ param_name = numbered_param
+ param_val = param
+ numbered_param += 1
+ for m2 in Rmarker.finditer(param_val):
+ param_val = param_val.replace(m2.group(),
+ inside[int(m2.group(1))])
+ for m2 in Rmarker2.finditer(param_val):
+ param_val = param_val.replace(m2.group(),
+ links[int(m2.group(1))])
+ for m2 in Rmarker3.finditer(param_val):
+ param_val = param_val.replace(m2.group(),
+ maths[int(m2.group(1))])
+ params[param_name] = param_val
+
+ # Add it to the result
+ result.append((name, params))
+ return result
+
Bugs item #2217938, was opened at 2008-11-03 04:17
Message generated for change (Comment added) made by nobody
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2217938&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: interwiki
Group: None
Status: Closed
Resolution: Fixed
Priority: 5
Private: No
Submitted By: Marc-Etienne Vargenau (vargenau)
Assigned to: Nobody/Anonymous (nobody)
Summary: Bot no longer writes file autonomous_problem.dat
Initial Comment:
Hello,
Since recently, the bot no longer writes file autonomous_problem.dat in case of conflict.
So you cannot run the bot manually afterwards to correct conflicts.
python version.py
Pywikipedia [http] trunk/pywikipedia (r6049, Nov 01 2008, 23:20:35)
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)]
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2008-11-17 12:59
Message:
since this is a log file, it would be logical to save it into /logs folder
----------------------------------------------------------------------
Comment By: Andre Engels (a_engels)
Date: 2008-11-03 06:59
Message:
Fixed in version 6051
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2217938&group_…
Patches item #2128343, was opened at 2008-09-25 21:38
Message generated for change (Settings changed) made by kwj2772
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=2128343&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: Closed
Resolution: None
Priority: 5
Private: No
Submitted By: Woo-Jin Kim (kwj2772)
Assigned to: Nobody/Anonymous (nobody)
Summary: checkimages.py - localization for ko changed
Initial Comment:
Some localizations are located in incorrect place and some message templates are moved.
URL
http://ko.wikipedia.org/wiki/User:Kwj2772/Checkimages.py
Thank you
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=2128343&group_…
Revision: 6103
Author: a_engels
Date: 2008-11-16 11:53:14 +0000 (Sun, 16 Nov 2008)
Log Message:
-----------
allow giving up on a page when asked about a disambiguation mismatch
Modified Paths:
--------------
trunk/pywikipedia/interwiki.py
Modified: trunk/pywikipedia/interwiki.py
===================================================================
--- trunk/pywikipedia/interwiki.py 2008-11-16 11:29:38 UTC (rev 6102)
+++ trunk/pywikipedia/interwiki.py 2008-11-16 11:53:14 UTC (rev 6103)
@@ -671,7 +671,7 @@
return True
return False
- def disambigMismatch(self, page):
+ def disambigMismatch(self, page, counter):
"""
Checks whether or not the given page has the another disambiguation
status than the origin page.
@@ -699,19 +699,22 @@
wikipedia.output(u"NOTE: Ignoring non-disambiguation page %s for %s because disambiguation page %s has already been found." % (page.aslink(True), self.originPage.aslink(True), self.getFoundDisambig(page.site()).aslink(True)))
return (True, None)
else:
- choice = wikipedia.inputChoice('WARNING: %s is a disambiguation page, but %s doesn\'t seem to be one. Follow it anyway?' % (self.originPage.aslink(True), page.aslink(True)), ['Yes', 'No', 'Add an alternative'], ['y', 'n', 'a'])
+ choice = wikipedia.inputChoice('WARNING: %s is a disambiguation page, but %s doesn\'t seem to be one. Follow it anyway?' % (self.originPage.aslink(True), page.aslink(True)), ['Yes', 'No', 'Add an alternative', 'Give up'], ['y', 'n', 'a', 'g'])
elif not self.originPage.isDisambig() and page.isDisambig():
if self.getFoundNonDisambig(page.site()):
wikipedia.output(u"NOTE: Ignoring disambiguation page %s for %s because non-disambiguation page %s has already been found." % (page.aslink(True), self.originPage.aslink(True), self.getFoundNonDisambig(page.site()).aslink(True)))
return (True, None)
else:
- choice = wikipedia.inputChoice('WARNING: %s doesn\'t seem to be a disambiguation page, but %s is one. Follow it anyway?' % (self.originPage.aslink(True), page.aslink(True)), ['Yes', 'No', 'Add an alternative'], ['y', 'n', 'a'])
+ choice = wikipedia.inputChoice('WARNING: %s doesn\'t seem to be a disambiguation page, but %s is one. Follow it anyway?' % (self.originPage.aslink(True), page.aslink(True)), ['Yes', 'No', 'Add an alternative', 'Give up'], ['y', 'n', 'a', 'g'])
if choice == 'n':
return (True, None)
elif choice == 'a':
newHint = wikipedia.input(u'Give the alternative for language %s, not using a language code:' % page.site().language())
alternativePage = wikipedia.Page(page.site(), newHint)
return (True, alternativePage)
+ elif choice == 'g':
+ self.makeForcedStop(counter)
+ return (True, None)
# We can follow the page.
return (False, None)
@@ -821,7 +824,7 @@
#except wikipedia.SectionError:
# wikipedia.output(u"NOTE: section %s does not exist" % page.aslink())
else:
- (skip, alternativePage) = self.disambigMismatch(page)
+ (skip, alternativePage) = self.disambigMismatch(page, counter)
if skip:
wikipedia.output(u"NOTE: ignoring %s and its interwiki links" % page.aslink(True))
if page in self.done: #XXX: Ugly bugfix - the following line has reportedly thrown "ValueError: list.remove(x): x not in list"