jenkins-bot has submitted this change and it was merged.
Change subject: Archivebot: Add 'isoyear' and 'isoweek'
......................................................................
Archivebot: Add 'isoyear' and 'isoweek'
Change-Id: I6b949dc73076493d927be1b2a42064d41ee210d2
---
M scripts/archivebot.py
1 file changed, 15 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 b56c6c5..015f924 100644
--- a/scripts/archivebot.py
+++ b/scripts/archivebot.py
@@ -56,11 +56,24 @@
%(counter)d the current value of the counter
%(year)d year of the thread being archived
+%(isoyear)d ISO year of the thread being archived
+%(isoweek)d ISO week number 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
+
+The ISO calendar starts with the Monday of the week which has at least four
+days in the new Gregorian calendar. If January 1st is between Monday and
+Thursday (including), the first week of that year started the Monday of that
+week, which is in the year before if January 1st is not a Monday. If it's
+between Friday or Sunday (including) the following week is then the first week
+of the year. So up to three days are still counted as the year before.
+
+See also:
+ -
http://www.phys.uu.nl/~vgent/calendar/isocalendar.htm
+ -
https://docs.python.org/3.4/library/datetime.html#datetime.date.isocalendar
Options (may be omitted):
-help show this help message and exit
@@ -456,6 +469,8 @@
params = {
'counter': arch_counter,
'year': t.timestamp.year,
+ 'isoyear': t.timestamp.isocalendar()[0],
+ 'isoweek': t.timestamp.isocalendar()[1],
'quarter': int(ceil(float(t.timestamp.month) / 3)),
'month': t.timestamp.month,
'monthname':
self.month_num2orig_names[t.timestamp.month]['long'],
--
To view, visit
https://gerrit.wikimedia.org/r/159094
To unsubscribe, visit
https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6b949dc73076493d927be1b2a42064d41ee210d2
Gerrit-PatchSet: 2
Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-Owner: Danmichaelo <danmichaelo(a)gmail.com>
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: Mpaa <mpaa.wiki(a)gmail.com>
Gerrit-Reviewer: XZise <CommodoreFabianus(a)gmx.de>
Gerrit-Reviewer: jenkins-bot <>