http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9379
Revision: 9379
Author: russblau
Date: 2011-07-15 14:28:43 +0000 (Fri, 15 Jul 2011)
Log Message:
-----------
Fix Bug 3309460: page.editTime() fails when using site.allpages()
Modified Paths:
--------------
branches/rewrite/pywikibot/page.py
Modified: branches/rewrite/pywikibot/page.py
===================================================================
--- branches/rewrite/pywikibot/page.py 2011-07-15 05:58:03 UTC (rev 9378)
+++ branches/rewrite/pywikibot/page.py 2011-07-15 14:28:43 UTC (rev 9379)
@@ -363,19 +363,28 @@
"""Return name or IP address of last user to edit page.
"""
- return self._revisions[self.latestRevision()].user
+ rev = self.latestRevision()
+ if rev not in self._revisions:
+ self.site.loadrevisions(self)
+ return self._revisions[rev].user
def isIpEdit(self):
"""Return True if last editor was unregistered.
"""
- return self._revisions[self.latestRevision()].anon
+ rev = self.latestRevision()
+ if rev not in self._revisions:
+ self.site.loadrevisions(self)
+ return self._revisions[rev].anon
def editTime(self):
"""Return timestamp (in ISO 8601 format) of last revision to page.
"""
- return self._revisions[self.latestRevision()].timestamp
+ rev = self.latestRevision()
+ if rev not in self._revisions:
+ self.site.loadrevisions(self)
+ return self._revisions[rev].timestamp
def previousRevision(self):
"""Return the revision id for the previous revision of this Page."""
http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9378
Revision: 9378
Author: xqt
Date: 2011-07-15 05:58:03 +0000 (Fri, 15 Jul 2011)
Log Message:
-----------
i18n tw support added
Modified Paths:
--------------
trunk/pywikipedia/add_text.py
Modified: trunk/pywikipedia/add_text.py
===================================================================
--- trunk/pywikipedia/add_text.py 2011-07-15 05:53:53 UTC (rev 9377)
+++ trunk/pywikipedia/add_text.py 2011-07-15 05:58:03 UTC (rev 9378)
@@ -75,6 +75,7 @@
import re, pagegenerators, urllib2, urllib
import wikipedia as pywikibot
+from pywikibot import i18n
import codecs, config
# This is required for the text that is shown when you run this script
@@ -83,29 +84,6 @@
'¶ms;': pagegenerators.parameterHelp,
}
-msg = {
- 'ar': u'بوت: إضافة %s',
- 'cs': u'Robot přidal %s',
- 'de': u'Bot: "%s" hinzugefügt',
- 'en': u'Bot: Adding %s',
- 'fr': u'Robot : Ajoute %s',
- 'he': u'בוט: מוסיף %s',
- 'fa': u'ربات: افزودن %s',
- 'it': u'Bot: Aggiungo %s',
- 'ja': u'ロボットによる: 追加 %s',
- 'ksh': u'Bot: dobeijedonn: %s',
- 'nds': u'Bot: tofoiegt: %s',
- 'nn': u'Robot: La til %s',
- 'pdc': u'Waddefresser: %s dezu geduh',
- 'pl': u'Robot dodaje: %s',
- 'pt': u'Bot: Adicionando %s',
- 'ru': u'Бот: добавление %s',
- 'sv': u'Bot: Lägger till %s',
- 'szl': u'Bot dodowo: %s',
- 'vo': u'Bot: Läükon vödemi: %s',
- 'zh': u'機器人: 正在新增 %s',
- }
-
nn_iw_msg = u'<!--interwiki (no, sv, da first; then other languages alphabetically by name)-->'
class NoEnoughData(pywikibot.Error):
@@ -158,7 +136,8 @@
if not addText:
raise NoEnoughData('You have to specify what text you want to add!')
if not summary:
- summary = pywikibot.translate(pywikibot.getSite(), msg) % addText[:200]
+ summary = i18n.twtranslate(pywikibot.getSite(), 'add_text-adding',
+ {'adding': addText[:200]})
# When a page is tagged as "really well written" it has a star in the
# interwiki links. This is a list of all the templates used (in regex