jenkins-bot has submitted this change and it was merged.
Change subject: archivebot: add 'quarter' to variables for page name patterns
......................................................................
archivebot: add 'quarter' to variables for page name patterns
'quarter' of the year is available as a variable when specifying archive page
names.
Related documentation comments are updated.
Change-Id: I7235aac26f7c577d4acde1b0b3466770f6a309d3
---
M scripts/archivebot.py
1 file changed, 11 insertions(+), 0 deletions(-)
Approvals:
John Vandenberg: Looks good to me, approved
jenkins-bot: Verified
diff --git a/scripts/archivebot.py b/scripts/archivebot.py
index 8b073e8..99dd033 100644
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -52,6 +52,15 @@
key A secret key that (if valid) allows archives to not be
subpages of the page being archived.
+Variables below can be used in the value for "archive" in the template above:
+
+%(counter)d the current value of the counter
+%(year)d year of the thread being archived
+%(quarter)d quarter of the year of the thread being archived
+%(month)d month (as a number 1-12) of the thread being archived
+%(monthname)s English name of the month above
+%(monthnameshort)s first three letters of the name above
+%(week)d week number of the thread being archived
Options (may be omitted):
-help show this help message and exit
@@ -78,6 +87,7 @@
import re
import locale
from hashlib import md5
+from math import ceil
import pywikibot
from pywikibot import i18n
@@ -421,6 +431,7 @@
params = {
'counter': arch_counter,
'year': t.timestamp.year,
+ 'quarter': int(ceil(float(t.timestamp.month) / 3)),
'month': t.timestamp.month,
'monthname':
self.month_num2orig_names[t.timestamp.month]['long'],
'monthnameshort':
self.month_num2orig_names[t.timestamp.month]['short'],
--
To view, visit
https://gerrit.wikimedia.org/r/150214
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I7235aac26f7c577d4acde1b0b3466770f6a309d3
Gerrit-PatchSet: 5
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Whym <whym(a)whym.org>
Gerrit-Reviewer: John Vandenberg <jayvdb(a)gmail.com>
Gerrit-Reviewer: Ladsgroup <ladsgroup(a)gmail.com>
Gerrit-Reviewer: Merlijn van Deen <valhallasw(a)arctus.nl>
Gerrit-Reviewer: Whym <whym(a)whym.org>
Gerrit-Reviewer: jenkins-bot <>