Xqt has submitted this change and it was merged.
Change subject: Invalid literal found for minutesDiff ......................................................................
Invalid literal found for minutesDiff
Fixed bug 55208 in core.
Change-Id: Ic7afd8a11b23d55e5bc9089b041e16bef3ad3d0e --- M scripts/interwiki.py 1 file changed, 8 insertions(+), 22 deletions(-)
Approvals: Xqt: Verified; Looks good to me, approved
diff --git a/scripts/interwiki.py b/scripts/interwiki.py index ff94157..0908443 100755 --- a/scripts/interwiki.py +++ b/scripts/interwiki.py @@ -348,6 +348,7 @@ import re import os import time +import datetime import codecs import pickle import socket @@ -1604,21 +1605,6 @@
"""
- #from clean_sandbox - def minutesDiff(time1, time2): - if type(time1) is long: - time1 = str(time1) - if type(time2) is long: - time2 = str(time2) - - t1 = ((((int(time1[0:4]) * 12 + int(time1[4:6])) * 30 + - int(time1[6:8])) * 24 + int(time1[8:10])) * 60 + - int(time1[10:12])) - t2 = ((((int(time2[0:4]) * 12 + int(time2[4:6])) * 30 + - int(time2[6:8])) * 24 + int(time2[8:10])) * 60 + \ - int(time2[10:12])) - return abs(t2 - t1) - if not self.isDone(): raise "Bugcheck: finish called before done" if not self.workonme: @@ -1756,19 +1742,19 @@ if not smallWikiAllowed: import userlib user = userlib.User(page.site, page.userName()) + # erstmal auch keine namen mit bot if not 'bot' in user.groups() \ - and not 'bot' in page.userName().lower(): # erstmal auch keine namen mit bot + and not 'bot' in page.userName().lower(): smallWikiAllowed = True else: - diff = minutesDiff(page.editTime(), - time.strftime("%Y%m%d%H%M%S", - time.gmtime())) - if diff > 30 * 24 * 60: + _now = datetime.datetime.utcnow() + _editTime = page.editTime() + if abs((_now - _editTime).days) > 30: smallWikiAllowed = True else: pywikibot.output( -u'NOTE: number of edits are restricted at %s' - % page.site.sitename()) + u'NOTE: number of edits are restricted at %s' + % page.site.sitename())
# if we have an account for this site if site.family.name in config.usernames and \
pywikibot-commits@lists.wikimedia.org