Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add _month_old()

  • Loading branch information...
commit 24f1119617f95c7230f42e788b37d7b55b8130ab 1 parent d96a725
@theopolisme authored
Showing with 10 additions and 0 deletions.
  1. +10 −0 nfur.py
View
10 nfur.py
@@ -1,6 +1,7 @@
#! /usr/bin/env python
from __future__ import unicode_literals
+import datetime
import sys
import re
@@ -81,6 +82,7 @@ def assert_okay(self):
conditions for processing.
"""
try:
+ self._month_old()
self._tagged()
self._usage()
self._infobox()
@@ -90,6 +92,14 @@ def assert_okay(self):
print "Error: ", unicode(e).encode('ascii', 'replace')
return False
+ def _month_old(self):
+ """Verifies that the image is at least a month old."""
+ timestamp = self.page.imagehistory().next()[u'timestamp']
+ if datetime.datetime.now() - datetime.datetime(*timestamp[:6]) > datetime.timedelta(30):
+ return True
+ else:
+ raise ValueError("{} was modified less than 30 days ago.".format(self.title))
+
def _infobox(self):
"""Verifies that the image is used in an infobox."""
for template in self.article_contents.filter_templates():
Please sign in to comment.
Something went wrong with that request. Please try again.