Update of /cvsroot/mailman/mailman/Mailman
In directory usw-pr-cvs1:/tmp/cvs-serv18477
Modified Files:
Tag: Release_2_0_1-branch
Utils.py
Log Message:
make_msgid(): Jason Mastaler's Python 1.5.2's version of a unique
Message-ID: string generator.
Index: Utils.py
===================================================================
RCS file: /cvsroot/mailman/mailman/Mailman/Utils.py,v
retrieving revision 1.104.2.5
retrieving revision 1.104.2.6
diff -C2 -d -r1.104.2.5 -r1.104.2.6
*** Utils.py 3 Apr 2002 22:47:12 -0000 1.104.2.5
--- Utils.py 4 Apr 2002 21:14:23 -0000 1.104.2.6
***************
*** 29,32 ****
--- 29,34 ----
import re
import time
+ import socket
+ import random
from UserDict import UserDict
from types import StringType
***************
*** 738,739 ****
--- 740,766 ----
now[0], now[3], now[4], now[5],
zone)
+
+
+
+ def make_msgid(idstring=None):
+ """Returns a string suitable for RFC 2822 compliant Message-ID:, e.g:
+
+ <[EMAIL PROTECTED]>
+
+ Optional idstring if given is a string used to strengthen the
+ uniqueness of the Message-ID, otherwise an empty string is used.
+ """
+ timeval = time.time()
+ utcdate = time.strftime('%Y%m%d%H%M%S', time.gmtime(timeval))
+ pid = os.getpid()
+ randint = random.randrange(100000)
+ if idstring is None:
+ idstring = ''
+ else:
+ idstring = '.' + idstring
+ try:
+ idhost = socket.getfqdn()
+ except AttributeError:
+ idhost = socket.gethostbyaddr(socket.gethostname())[0]
+ msgid = '<%s.%s.%s%s@%s>' % (utcdate, pid, randint, idstring, idhost)
+ return msgid
_______________________________________________
Mailman-checkins mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-checkins