jenkins-bot merged this change.

View Change

Approvals: Xqt: Looks good to me, approved jenkins-bot: Verified
Improve readability and simplify _handle_recentchanges

Change-Id: I7a7e7a025dab575e7f8b0cca3f0dc5c090aa83ad
---
M pywikibot/pagegenerators.py
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/pywikibot/pagegenerators.py b/pywikibot/pagegenerators.py
index bceae51..04a80df 100644
--- a/pywikibot/pagegenerators.py
+++ b/pywikibot/pagegenerators.py
@@ -801,19 +801,18 @@
params = value.split(',') if value else []
if params and not params[0].isdigit():
rctag = params.pop(0)
- if len(params) == 2:
+ if len(params) > 2:
+ raise ValueError('More than two parameters passed.')
+ elif len(params) == 2:
offset = float(params[0])
duration = float(params[1])
if offset < 0 or duration < 0:
raise ValueError('Negative valued parameters passed.')
- elif len(params) > 2:
- raise ValueError('More than two parameters passed.')
- else:
- total = int(params[0]) if params else 60
- if len(params) == 2:
ts_time = self.site.server_time()
rcstart = ts_time + timedelta(minutes=-(offset + duration))
rcend = ts_time + timedelta(minutes=-offset)
+ else:
+ total = int(params[0]) if params else 60
return RecentChangesPageGenerator(
namespaces=self.namespaces, total=total, start=rcstart, end=rcend,
site=self.site, reverse=True, tag=rctag,

To view, visit change 444820. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I7a7e7a025dab575e7f8b0cca3f0dc5c090aa83ad
Gerrit-Change-Number: 444820
Gerrit-PatchSet: 1
Gerrit-Owner: Matěj Suchánek <matejsuchanek97@gmail.com>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot