Revision: 6427
Author: nicdumz
Date: 2009-02-23 09:50:54 +0000 (Mon, 23 Feb 2009)
Log Message:
-----------
Converting Page.aslink(..) calls to Page.title(asLink=True, ...) calls
Modified Paths:
--------------
branches/rewrite/pywikibot/pagegenerators.py
branches/rewrite/pywikibot/scripts/category.py
branches/rewrite/pywikibot/scripts/replace.py
branches/rewrite/pywikibot/scripts/touch.py
branches/rewrite/pywikibot/textlib.py
Modified: branches/rewrite/pywikibot/pagegenerators.py
===================================================================
--- branches/rewrite/pywikibot/pagegenerators.py 2009-02-23 09:35:21 UTC (rev 6426)
+++ branches/rewrite/pywikibot/pagegenerators.py 2009-02-23 09:50:54 UTC (rev 6427)
@@ -940,7 +940,7 @@
site = pywikibot.Site()
fd = date.FormatDate(site)
firstPage = pywikibot.Page(site, fd(startMonth, 1))
- pywikibot.output(u"Starting with %s" % firstPage.aslink())
+ pywikibot.output(u"Starting with %s" % firstPage.title(asLink=True))
for month in xrange(startMonth, endMonth+1):
for day in xrange(1, date.getNumberOfDaysInMonth(month)+1):
yield pywikibot.Page(pywikibot.Link(fd(month, day), site))
Modified: branches/rewrite/pywikibot/scripts/category.py
===================================================================
--- branches/rewrite/pywikibot/scripts/category.py 2009-02-23 09:35:21 UTC (rev 6426)
+++ branches/rewrite/pywikibot/scripts/category.py 2009-02-23 09:50:54 UTC (rev 6427)
@@ -357,7 +357,7 @@
answer = ''
while answer not in ('y','n','a'):
- answer = pywikibot.input(u'%s [y/n/a(ll)]:' % (page.aslink()))
+ answer = pywikibot.input(u'%s [y/n/a(ll)]:' %
(page.title(asLink=True)))
if answer == 'a':
confirm = ''
while confirm not in ('y','n'):
@@ -397,7 +397,7 @@
pywikibot.output(u"%s is already in %s."
% (page.title(), catpl.title()))
else:
- pywikibot.output(u'Adding %s' % catpl.aslink())
+ pywikibot.output(u'Adding %s' %
catpl.title(asLink=True))
cats.append(catpl)
text = page.get()
text = pywikibot.replaceCategoryLinks(text, cats)
Modified: branches/rewrite/pywikibot/scripts/replace.py
===================================================================
--- branches/rewrite/pywikibot/scripts/replace.py 2009-02-23 09:35:21 UTC (rev 6426)
+++ branches/rewrite/pywikibot/scripts/replace.py 2009-02-23 09:50:54 UTC (rev 6427)
@@ -353,30 +353,30 @@
if self.isTitleExcepted(page.title()):
pywikibot.output(
u'Skipping %s because the title is on the exceptions list.'
- % page.aslink())
+ % page.title(asLink=True))
continue
try:
# Load the page's text from the wiki
original_text = page.get(get_redirect=True)
if not page.canBeEdited():
pywikibot.output(u"You can't edit page %s"
- % page.aslink())
+ % page.title(asLink=True))
continue
except pywikibot.NoPage:
- pywikibot.output(u'Page %s not found' % page.aslink())
+ pywikibot.output(u'Page %s not found' % page.title(asLink=True))
continue
new_text = original_text
while True:
if self.isTextExcepted(new_text):
pywikibot.output(
u'Skipping %s because it contains text that is on the exceptions list.'
- % page.aslink())
+ % page.title(asLink=True))
break
new_text = self.doReplacements(new_text)
if new_text.strip().replace('\r\n', '\n'
) == original_text.strip().replace('\r\n',
'\n'):
pywikibot.output(u'No changes were necessary in %s'
- % page.aslink())
+ % page.title(asLink=True))
break
if self.recursive:
newest_text = self.doReplacements(new_text)
Modified: branches/rewrite/pywikibot/scripts/touch.py
===================================================================
--- branches/rewrite/pywikibot/scripts/touch.py 2009-02-23 09:35:21 UTC (rev 6426)
+++ branches/rewrite/pywikibot/scripts/touch.py 2009-02-23 09:50:54 UTC (rev 6427)
@@ -39,14 +39,14 @@
text = page.get(get_redirect = self.touch_redirects)
page.save("Pywikibot touch script")
except pywikibot.NoPage:
- pywikibot.output(u"Page %s does not exist?!" % page.aslink(),
+ pywikibot.output(u"Page %s does not exist?!" %
page.title(asLink=True),
level=pywikibot.ERROR)
except pywikibot.IsRedirectPage:
pywikibot.output(u"Page %s is a redirect; skipping."
- % page.aslink(),
+ % page.title(asLink=True),
level=pywikibot.WARNING)
except pywikibot.LockedPage:
- pywikibot.output(u"Page %s is locked?!" % page.aslink(),
+ pywikibot.output(u"Page %s is locked?!" %
page.title(asLink=True),
level=pywikibot.ERROR)
Modified: branches/rewrite/pywikibot/textlib.py
===================================================================
--- branches/rewrite/pywikibot/textlib.py 2009-02-23 09:35:21 UTC (rev 6426)
+++ branches/rewrite/pywikibot/textlib.py 2009-02-23 09:50:54 UTC (rev 6427)
@@ -418,7 +418,7 @@
s = []
for site in ar:
try:
- link = links[site].aslink(forceInterwiki=True)
+ link = links[site].title(asLink=True, forceInterwiki=True)
s.append(link)
except AttributeError:
s.append(pywikibot.getSite(site).linkto(links[site],
@@ -633,7 +633,7 @@
return ''
if insite is None:
insite = pywikibot.getSite()
- catLinks = [category.aslink(noInterwiki = True) for category in categories]
+ catLinks = [category.title(asLink=True, noInterwiki = True) for category in
categories]
if insite.category_on_one_line():
sep = ' '
else:
Show replies by date