[mhonarc] move regexp from subroutine to class, increase copyright to 2013
- From: Olav Vitters <ovitters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mhonarc] move regexp from subroutine to class, increase copyright to 2013
- Date: Fri, 15 Feb 2013 13:44:17 +0000 (UTC)
commit db5316a0a72fa845f6548c93892663511eadd48f
Author: Olav Vitters <olav vitters nl>
Date: Fri Feb 15 14:44:10 2013 +0100
move regexp from subroutine to class, increase copyright to 2013
archive.py | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/archive.py b/archive.py
index 09c8deb..be2497a 100755
--- a/archive.py
+++ b/archive.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python -3
import os
import os.path
@@ -76,6 +76,11 @@ class Archiver:
'december': 12
}
+ _fromlinepattern = (r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+"
+ r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*"
+ r"[^\s]*\s*"
+ "$")
+
def __init__(self, listname, private=False, debug=False,
start_time = None, end_time = None):
@@ -85,6 +90,8 @@ class Archiver:
self.start_time = start_time
self.end_time = end_time
+ self.re_from = re.compile(self._fromlinepattern)
+
def output(self, newmsgs, archivepath):
"""Call mhonarc to archive all messages contained in newmsgs to archivepath"""
if archivepath is None:
@@ -195,11 +202,7 @@ class Archiver:
"""Process a filedescriptor for multiple emails seperated using the mbox format
Calls handle_message for each individual message"""
- _fromlinepattern = (r"From \s*[^\s]+\s+\w\w\w\s+\w\w\w\s+\d?\d\s+"
- r"\d?\d:\d\d(:\d\d)?(\s+[^\s]+)?\s+\d\d\d\d\s*"
- r"[^\s]*\s*"
- "$")
- re_from = re.compile(_fromlinepattern)
+ re_from = self.re_from
blank = True
archivepath = None
@@ -258,7 +261,7 @@ class Archiver:
#
# Archive directory should be: YYYY-MMMMMMM
# where YYYY=year
- # and MMMMMMM=month name (january)
+ # and MMMMMMM=month name (January)
#
# This function assumes that the months are in English, see
# Archiver.MONTHS
@@ -536,7 +539,7 @@ Search:
</div>
<div id="footnotes" class="grid_9">
- <p> Copyright © 2005 - 2012 <a href="http://www.gnome.org/"><strong>The GNOME
Project</strong></a>.<br />
+ <p> Copyright © 2005 - 2013 <a href="http://www.gnome.org/"><strong>The GNOME
Project</strong></a>.<br />
<small><a href="http://validator.w3.org/check/referer">Optimised</a> for <a href=
"http://www.w3.org/">standards</a>. Hosted by <a href=
"http://www.redhat.com/">Red Hat</a>.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]