Update of /cvsroot/mailman/mailman/Mailman/Archiver
In directory sc8-pr-cvs1:/tmp/cvs-serv7502/Mailman/Archiver

Modified Files:
      Tag: Release_2_1-maint
        Archiver.py HyperArch.py pipermail.py 
Log Message:
Backporting from the HEAD -- updated archiver











Index: Archiver.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Archiver/Archiver.py,v
retrieving revision 2.28
retrieving revision 2.28.2.1
diff -u -d -r2.28 -r2.28.2.1
--- Archiver.py 12 Nov 2002 21:05:38 -0000      2.28
+++ Archiver.py 22 Sep 2003 02:40:51 -0000      2.28.2.1
@@ -1,4 +1,4 @@
-# Copyright (C) 1998,1999,2000,2001,2002 by the Free Software Foundation, Inc.
+# Copyright (C) 1998-2003 by the Free Software Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -166,7 +166,9 @@
             raise
 
     def ExternalArchive(self, ar, txt):
-        d = SafeDict({'listname': self.internal_name()})
+        d = SafeDict({'listname': self.internal_name(),
+                      'hostname': self.host_name,
+                      })
         cmd = ar % d
         extarch = os.popen(cmd, 'w')
         extarch.write(txt)

Index: HyperArch.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Archiver/HyperArch.py,v
retrieving revision 2.37.2.3
retrieving revision 2.37.2.4
diff -u -d -r2.37.2.3 -r2.37.2.4
--- HyperArch.py        8 Feb 2003 07:13:49 -0000       2.37.2.3
+++ HyperArch.py        22 Sep 2003 02:40:51 -0000      2.37.2.4
@@ -83,6 +83,13 @@
         resource.setrlimit(resource.RLIMIT_STACK, (newsoft, hard))
 
 
+try:
+    True, False
+except NameError:
+    True = 1
+    False = 0
+
+
 
 def html_quote(s, lang=None):
     repls = ( ('&', '&'),
@@ -159,21 +166,44 @@
 
 
 
-# This doesn't need to be a weakref instance because it's just storing
-# strings.  Keys are (templatefile, lang) tuples.
+# Like Utils.maketext() but with caching to improve performance.
+#
+# _templatefilepathcache is used to associate a (templatefile, lang, listname)
+# key with the file system path to a template file.  This path is the one that
+# the Utils.findtext() function has computed is the one to match the values in
+# the key tuple.
+#
+# _templatecache associate a file system path as key with the text
+# returned after processing the contents of that file by Utils.findtext()
+#
+# We keep two caches to reduce the amount of template text kept in memory,
+# since the _templatefilepathcache is a many->one mapping and _templatecache
+# is a one->one mapping.  Imagine 1000 lists all using the same default
+# English template.
+
+_templatefilepathcache = {}
 _templatecache = {}
 
 def quick_maketext(templatefile, dict=None, lang=None, mlist=None):
+    if mlist is None:
+        listname = ''
+    else:
+        listname = mlist._internal_name
     if lang is None:
         if mlist is None:
             lang = mm_cfg.DEFAULT_SERVER_LANGUAGE
         else:
             lang = mlist.preferred_language
-    template = _templatecache.get((templatefile, lang))
-    if template is None:
+    cachekey = (templatefile, lang, listname)
+    filepath =  _templatefilepathcache.get(cachekey)
+    if filepath:
+        template = _templatecache.get(filepath)
+    if filepath is None or template is None:
         # Use the basic maketext, with defaults to get the raw template
-        template = Utils.maketext(templatefile, lang=lang, raw=1)
-        _templatecache[(templatefile, lang)] = template
+        template, filepath = Utils.findtext(templatefile, lang=lang,
+                                            raw=True, mlist=mlist)
+        _templatefilepathcache[cachekey] = filepath
+        _templatecache[filepath] = template
     # Copied from Utils.maketext()
     text = template
     if dict is not None:

Index: pipermail.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Archiver/pipermail.py,v
retrieving revision 2.22.2.1
retrieving revision 2.22.2.2
diff -u -d -r2.22.2.1 -r2.22.2.2
--- pipermail.py        10 Jan 2003 20:29:41 -0000      2.22.2.1
+++ pipermail.py        22 Sep 2003 02:40:51 -0000      2.22.2.2
@@ -7,7 +7,7 @@
 import re
 import sys
 import time
-from email.Utils import parseaddr, parsedate_tz
+from email.Utils import parseaddr, parsedate_tz, mktime_tz
 import cPickle as pickle
 from cStringIO import StringIO
 from string import lowercase
@@ -224,7 +224,7 @@
                 return None
             date = parsedate_tz(datestr)
             try:
-                return time.mktime(date[:9])
+                return mktime_tz(date)
             except (TypeError, ValueError, OverflowError):
                 return None
         date = floatdate('date')



_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins

Reply via email to