1.1 --- a/MoinMessage.py Fri Apr 10 17:21:27 2015 +0200
1.2 +++ b/MoinMessage.py Sat Apr 11 17:07:36 2015 +0200
1.3 @@ -19,7 +19,6 @@
1.4 from subprocess import Popen, PIPE
1.5 from tempfile import mkstemp
1.6 from urlparse import urlsplit
1.7 -from DateSupport import getDateTimeFromRFC2822
1.8 from GPGUtils import GPG, GPGError, GPGDecodingError, GPGMissingPart, GPGBadContent, \
1.9 as_string, is_signed, is_encrypted, getContentAndSignature
1.10 import httplib
1.11 @@ -60,10 +59,7 @@
1.12
1.13 "Obtain the date of the given 'message'."
1.14
1.15 - if message.has_key("Date"):
1.16 - self.date = getDateTimeFromRFC2822(message["Date"])
1.17 - else:
1.18 - self.date = None
1.19 + self.date = message.get("Date")
1.20
1.21 def parse_text(self, text):
1.22
2.1 --- a/MoinMessageSupport.py Fri Apr 10 17:21:27 2015 +0200
2.2 +++ b/MoinMessageSupport.py Sat Apr 11 17:07:36 2015 +0200
2.3 @@ -2,7 +2,7 @@
2.4 """
2.5 MoinMoin - MoinMessageSupport library
2.6
2.7 - @copyright: 2012, 2013, 2014 by Paul Boddie <paul@boddie.org.uk>
2.8 + @copyright: 2012, 2013, 2014, 2015 by Paul Boddie <paul@boddie.org.uk>
2.9 @license: GNU GPL (v2 or later), see COPYING.txt for details.
2.10 """
2.11
2.12 @@ -20,6 +20,7 @@
2.13 is_signed, is_encrypted, getContentAndSignature
2.14 from MoinSupport import getHeader, getMetadata, getWikiDict, writeHeaders, \
2.15 parseDictEntry, getStaticContentDirectory
2.16 +from DateSupport import getDateTimeFromRFC2822
2.17 from ItemSupport import ItemStore
2.18 from TokenSupport import getIdentifiers
2.19
2.20 @@ -253,6 +254,7 @@
2.21 # Test any date against the page or message store (if not empty).
2.22
2.23 if message.date:
2.24 + date = getDateTimeFromRFC2822(message.date)
2.25 store_date = time.gmtime(self.store.mtime())
2.26 page_date = time.gmtime(version2timestamp(self.page.mtime_usecs()))
2.27
2.28 @@ -263,9 +265,9 @@
2.29
2.30 # Reject messages older than the page date.
2.31
2.32 - if message.date.to_utc().as_tuple() < last_date:
2.33 + if date.to_utc().as_tuple() < last_date:
2.34 writeHeaders(request, "text/plain", getMetadata(self.page), "403 Forbidden")
2.35 - request.write("The message is too old: %s versus %s." % (message.date, time.strftime("%Y-%m-%d %H:%M:%S", last_date)))
2.36 + request.write("The message is too old: %s versus %s." % (date, time.strftime("%Y-%m-%d %H:%M:%S", last_date)))
2.37 return
2.38
2.39 # Reject messages without dates if so configured.
3.1 --- a/actions/PostMessage.py Fri Apr 10 17:21:27 2015 +0200
3.2 +++ b/actions/PostMessage.py Sat Apr 11 17:07:36 2015 +0200
3.3 @@ -100,7 +100,7 @@
3.4 # Propagate time information using the unintuitive time functions.
3.5
3.6 if message.date:
3.7 - update["Date"] = message.date.as_RFC2822_datetime_string()
3.8 + update["Date"] = message.date
3.9
3.10 self.store.append(as_string(update))
3.11