Bugs item #1887935, was opened at 2008-02-06 16:34
Message generated for change (Comment added) made by rotemliss
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1887935&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: General
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: giurrero (giurrero)
Assigned to: Nobody/Anonymous (nobody)
Summary: wikipedia.templatesWithParams
Initial Comment:
bug in function wikipedia.templatesWithParams
==== page.get() ===
{{MyTemplate
|field1 = value1
|field2 = [[value2|two]]
}}
=============
page.templatesWithParams()
expected:
[(u'MyTemplate', [u'field1 = value1\n', u'field2 = [[value2|two]]\n'])]
got:
[(u'MyTemplate', [u'field1 = value1\n', u'field2 = [[value2', u'two]]\n'])]
----------------------------------------------------------------------
>Comment By: Rotem Liss (rotemliss)
Date: 2008-02-09 15:19
Message:
Logged In: YES
user_id=1327030
Originator: NO
Fixed in r4989.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1887935&group_…
Revision: 4989
Author: rotem
Date: 2008-02-09 13:19:02 +0000 (Sat, 09 Feb 2008)
Log Message:
-----------
(bug 1887935) Problems with links in templatesWithParams
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2008-02-09 13:01:56 UTC (rev 4988)
+++ trunk/pywikipedia/wikipedia.py 2008-02-09 13:19:02 UTC (rev 4989)
@@ -1558,19 +1558,17 @@
def templates(self):
"""Return a list of Page objects for templates used on this Page.
-
+
Template parameters are ignored.
-
"""
return [template for (template, param) in self.templatesWithParams()]
def templatesWithParams(self):
"""Return a list of templates used on this Page.
-
+
Return value is a list of tuples. There is one tuple for each use of
a template in the page, with the template Page as the first entry
and a list of parameters as the second entry.
-
"""
try:
thistxt = self.get()
@@ -1580,16 +1578,23 @@
# remove commented-out stuff etc.
thistxt = removeDisabledParts(thistxt)
- # marker for inside template
+ # marker for inside templates or parameters
marker = '@@'
while marker in thistxt:
marker += '@'
+ # marker for links
+ marker2 = '##'
+ while marker2 in thistxt:
+ marker2 += '#'
+
result = []
- markers = {}
+ inside = {}
count = 0
Rtemplate = re.compile(r'{{(msg:)?(?P<name>[^{\|]+?)(\|(?P<params>[^{]+?))?}}')
+ Rlink = re.compile(r'\[\[[^\]]+\]\]')
Rmarker = re.compile('%s(\\d+)%s' % (marker, marker))
+ Rmarker2 = re.compile('%s(\\d+)%s' % (marker2, marker2))
while Rtemplate.search(thistxt) is not None:
for m in Rtemplate.finditer(thistxt):
# Make sure it is not detected again
@@ -1597,9 +1602,9 @@
text = m.group()
thistxt = thistxt.replace(text, '%s%d%s' % (marker, count, marker))
for m2 in Rmarker.finditer(text):
- # Make sure markers don't contain other markers
- text = text.replace(m2.group(), markers[int(m2.group(1))])
- markers[count] = text
+ # Make sure stored templates don't contain markers
+ text = text.replace(m2.group(), inside[int(m2.group(1))])
+ inside[count] = text
# Name
name = m.group('name')
@@ -1620,12 +1625,22 @@
paramString = m.group('params')
params = []
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, count, marker2))
+ links[count2] = text
# 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))])
+ param = param.replace(m2.group(), inside[int(m2.group(1))])
+ for m2 in Rmarker2.finditer(param):
+ param = param.replace(m2.group(), links[int(m2.group(1))])
params.append(param)
# Add it to the result
Revision: 4988
Author: rotem
Date: 2008-02-09 13:01:56 +0000 (Sat, 09 Feb 2008)
Log Message:
-----------
Page.linkedPages() should not contain image links by default, as they are not normal links.
Modified Paths:
--------------
trunk/pywikipedia/wikipedia.py
Modified: trunk/pywikipedia/wikipedia.py
===================================================================
--- trunk/pywikipedia/wikipedia.py 2008-02-09 12:54:10 UTC (rev 4987)
+++ trunk/pywikipedia/wikipedia.py 2008-02-09 13:01:56 UTC (rev 4988)
@@ -1486,11 +1486,10 @@
# representation of an instance can not change after the construction.
return hash(str(self))
- def linkedPages(self):
+ def linkedPages(self, withImageLinks = False):
"""Return a list of Pages that this Page links to.
- Excludes interwiki and category links.
-
+ Excludes interwiki and category links, and also image links by default.
"""
result = []
try:
@@ -1498,7 +1497,6 @@
self.site())
except NoPage:
raise
- #return []
except IsRedirectPage:
raise
except SectionError:
@@ -1521,6 +1519,8 @@
output(u"Page %s contains invalid link to [[%s]]."
% (self.title(), title))
continue
+ if not withImageLinks and page.isImage():
+ continue
if page.sectionFreeTitle():
result.append(page)
return result
@@ -1536,7 +1536,7 @@
"""
results = []
# Find normal images
- for page in self.linkedPages():
+ for page in self.linkedPages(withImageLinks = True):
if page.isImage():
# convert Page object to ImagePage object
imagePage = ImagePage(page.site(), page.title())
Patches item #1890105, was opened at 2008-02-09 13:26
Message generated for change (Comment added) made by rotemliss
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1890105&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: Fixed
Priority: 5
Private: No
Submitted By: Alex S.H. Lin (lin4h)
Assigned to: Nobody/Anonymous (nobody)
Summary: update locale and wikinews langs
Initial Comment:
add yi redirect fix message, and new langs for wikinews (ta,sd).
----------------------------------------------------------------------
>Comment By: Rotem Liss (rotemliss)
Date: 2008-02-09 14:54
Message:
Logged In: YES
user_id=1327030
Originator: NO
Added new languages for Wikinews in r4987.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1890105&group_…
Patches item #1890105, was opened at 2008-02-09 19:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1890105&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 locale and wikinews langs
Initial Comment:
add yi redirect fix message, and new langs for wikinews (ta,sd).
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603140&aid=1890105&group_…
Support Requests item #1875225, was opened at 2008-01-19 01:33
Message generated for change (Comment added) made by sf-robot
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603139&aid=1875225&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
Priority: 5
Private: No
Submitted By: Nedueb (nedueb)
Assigned to: Nobody/Anonymous (nobody)
Summary: Category.py bot script will not 'remove'
Initial Comment:
I have been using the very useful python wikipediabot. However, I am trying to remove a particular category tag from all pages in a category
using the Category.py bot script. When I do the script appears to work. It finds the relevant pages (for example [[Page X]] in Category:Y), then says ERROR: [[Page X]] is not in category Category:Y.
and does not remove it.
is this a common bug and is there a way I canfix it/get around it to remove category tags en masse.
----------------------------------------------------------------------
>Comment By: SourceForge Robot (sf-robot)
Date: 2008-02-07 19:20
Message:
Logged In: YES
user_id=1312539
Originator: NO
This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
----------------------------------------------------------------------
Comment By: Rotem Liss (rotemliss)
Date: 2008-01-24 09:14
Message:
Logged In: YES
user_id=1327030
Originator: NO
I can't reproduce this bug. Which wiki do you try to use, what is its
language, and which pages raise such errors?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603139&aid=1875225&group_…
Feature Requests item #1888694, was opened at 2008-02-07 11:32
Message generated for change (Comment added) made by sf_nokymacha
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1888694&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
Priority: 5
Private: No
Submitted By: sf_noky (sf_nokymacha)
Assigned to: Nobody/Anonymous (nobody)
Summary: solve_disambiguation.py - ko (Korean) translation
Initial Comment:
solve_disambiguation.py - ko (Korean) translation. Thank you.
----------------------------------------------------------------------
>Comment By: sf_noky (sf_nokymacha)
Date: 2008-02-07 11:58
Message:
Logged In: YES
user_id=1966283
Originator: YES
File Added: solve_disambiguation_diff1.txt
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1888694&group_…
Feature Requests item #1888694, was opened at 2008-02-07 11:32
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1888694&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
Priority: 5
Private: No
Submitted By: sf_noky (sf_nokymacha)
Assigned to: Nobody/Anonymous (nobody)
Summary: solve_disambiguation.py - ko (Korean) translation
Initial Comment:
solve_disambiguation.py - ko (Korean) translation. Thank you.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1888694&group_…