jenkins-bot has submitted this change and it was merged.
Change subject: [compat2core] combat to core conversion
......................................................................
[compat2core] combat to core conversion
- self.templates never used; remove it
- templatesWithParams() gives a Page object instead a str. The title is
already normalized then.
- use two variables for assigning the tuple
- FilePage.templates is already used in core.
Rename private list to review_tpl.
- Page needs a Site to be created.
A site code as first parameter doesn't longer work in core.
- editTime() gives a Timestamp but not a mediawiki timestamp.
use totimestampformat() method to convert it in right format.
Change-Id: Id5d27004dbefb989d14e9f3f6217f869239ea3a1
---
M imagereview.py
1 file changed, 18 insertions(+), 13 deletions(-)
Approvals:
Xqt: Looks good to me, approved
jenkins-bot: Verified
diff --git a/imagereview.py b/imagereview.py
index c9526f6..d8c7b6c 100644
--- a/imagereview.py
+++ b/imagereview.py
@@ -209,12 +209,17 @@
MAX_EMAIL = 20 # version 1.21wmf10
-class DUP_Image(pywikibot.ImagePage):
+class DUP_Image(pywikibot.FilePage):
+
+ """FilePage holding review informations."""
def __init__(self, site, title, text=None, timestamp=None):
+ """Constructor."""
pywikibot.ImagePage.__init__(self, site, title)
self._contents = text
- self.templates = []
+ # NOTE: self.templates is already used by FilePage in core
+ # but it isn't in compat.
+ self.review_tpl = [] # used by informuser()
self.reasons = set()
self.info = False
self.done = None
@@ -223,17 +228,16 @@
# breaking change mit
# https://www.mediawiki.org/wiki/Special:Code/pywikipedia/11347
# Vorlage sind damit normalisiert!
- TEMPL = (u'DÜP', u'dÜP', u'Düp', u'düp', u'Dateiüberprüfung',
- u'dateiüberprüfung',)
+ TEMPL = ('DÜP', 'Düp', 'Dateiüberprüfung')
if self._contents:
self.done = u"3=[[Benutzer:Xqbot|Xqbot]]" in self._contents
- for t in self.templatesWithParams():
- if t[0] in TEMPL:
- self.templates.append(t[0])
- for r in t[1]:
+ for tpl, param in self.templatesWithParams():
+ if tpl.title(withNamespace=False) in TEMPL:
+ self.review_tpl.append(tpl)
+ for r in param:
if r.strip():
self.reasons.add(r.strip())
- if t[0] in (u'Information', 'information'):
+ if tpl.title(withNamespace=False) == 'Information':
self.info = True
@property
@@ -416,8 +420,9 @@
"""
# verstorbene
ignoreUser = set()
- ignorePage = pywikibot.Page('de',
- u'Wikipedia:Gedenkseite für verstorbene
Wikipedianer')
+ ignorePage = pywikibot.Page(
+ self.site,
+ 'Wikipedia:Gedenkseite für verstorbene Wikipedianer')
for p in ignorePage.linkedPages():
if p.namespace() == 2:
ignoreUser.add(p.title(withNamespace=False).split('/')[0])
@@ -558,7 +563,7 @@
# jetzt alle Dateien eines Benutzers bearbeiten
for i in images:
- tmpl = i.templates
+ tmpl = i.review_tpl
if not tmpl:
print('template nicht gefunden für', i.title())
continue
@@ -613,7 +618,7 @@
print(k, 'fehlt')
return r
try:
- r = int(table[k][0][2].editTime())
+ r = int(table[k][0][2].editTime().totimestampformat())
except IndexError:
print(k)
print(table[k][0])
--
To view, visit https://gerrit.wikimedia.org/r/282368
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id5d27004dbefb989d14e9f3f6217f869239ea3a1
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/bots/xqbot
Gerrit-Branch: master
Gerrit-Owner: Xqt <[email protected]>
Gerrit-Reviewer: Xqt <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits