------------------------------------------------------------
revno: 6538
committer: Barry Warsaw <[EMAIL PROTECTED]>
branch nick: 3.0
timestamp: Wed 2007-08-01 17:05:06 -0400
message:
Repair some test suite regressions.
modified:
Mailman/Handlers/Hold.py
Mailman/LockFile.py
Mailman/Message.py
Mailman/Queue/NewsRunner.py
Mailman/docs/addresses.txt
Mailman/docs/hold.txt
Mailman/docs/news-runner.txt
Mailman/docs/pending.txt
=== modified file 'Mailman/Handlers/Hold.py'
--- a/Mailman/Handlers/Hold.py 2007-08-01 20:11:08 +0000
+++ b/Mailman/Handlers/Hold.py 2007-08-01 21:05:06 +0000
@@ -35,12 +35,14 @@
from email.mime.message import MIMEMessage
from email.mime.text import MIMEText
from types import ClassType
+from zope.interface import implements
from Mailman import Errors
from Mailman import Message
-from Mailman import Pending
from Mailman import Utils
from Mailman import i18n
+from Mailman.configuration import config
+from Mailman.interfaces import IPendable, IPending
log = logging.getLogger('mailman.vette')
@@ -129,6 +131,12 @@
+class HeldMessagePendable(dict):
+ implements(IPendable)
+ PEND_KEY = 'held message'
+
+
+
def process(mlist, msg, msgdata):
if msgdata.get('approved'):
return
@@ -239,7 +247,9 @@
#
# This message should appear to come from <list>-admin so as to handle any
# bounce processing that might be needed.
- cookie = mlist.pend_new(Pending.HELD_MESSAGE, id)
+ pendable = HeldMessagePendable(type=HeldMessagePendable.PEND_KEY,
+ id=str(id))
+ token = IPending(config.db).add(pendable)
# Get the language to send the response in. If the sender is a member,
# then send it in the member's language, otherwise send it in the mailing
# list's preferred language.
@@ -247,9 +257,9 @@
lang = (member.preferred_language if member else mlist.preferred_language)
if not fromusenet and ackp(msg) and mlist.respond_to_post_requests and \
mlist.autorespondToSender(sender, lang):
- # Get a confirmation cookie
+ # Get a confirmation token
d['confirmurl'] = '%s/%s' % (mlist.GetScriptURL('confirm', absolute=1),
- cookie)
+ token)
lang = msgdata.get('lang', lang)
subject = _('Your message to $listname awaits moderator approval')
text = Utils.maketext('postheld.txt', d, lang=lang, mlist=mlist)
@@ -284,7 +294,7 @@
message will be approved for posting to the list. The Approved: header can
also appear in the first line of the body of the reply.""")),
_charset=Utils.GetCharSet(lang))
- dmsg['Subject'] = 'confirm ' + cookie
+ dmsg['Subject'] = 'confirm ' + token
dmsg['Sender'] = requestaddr
dmsg['From'] = requestaddr
dmsg['Date'] = email.utils.formatdate(localtime=True)
=== modified file 'Mailman/LockFile.py'
--- a/Mailman/LockFile.py 2007-05-28 20:21:41 +0000
+++ b/Mailman/LockFile.py 2007-08-01 21:05:06 +0000
@@ -59,12 +59,13 @@
import random
import socket
import logging
+import datetime
import traceback
# Units are floating-point seconds.
-DEFAULT_LOCK_LIFETIME = 15
+DEFAULT_LOCK_LIFETIME = datetime.timedelta(seconds=15)
# Allowable a bit of clock skew
-CLOCK_SLOP = 10
+CLOCK_SLOP = datetime.timedelta(seconds=10)
# This is appropriate for Mailman, but you may want to change this if you're
# using this code outside Mailman.
log = logging.getLogger('mailman.locks')
@@ -95,8 +96,8 @@
Create the resource lock using lockfile as the global lock file. Each
process laying claim to this resource lock will create their own
temporary lock files based on the path specified by lockfile.
- Optional lifetime is the number of seconds the process expects to hold
- the lock.
+ Optional lifetime is a timedelta specifying the number of seconds the
+ process expects to hold the lock.
set_lifetime(lifetime):
Set a new lock lifetime. This takes affect the next time the file is
@@ -155,7 +156,7 @@
self._owned = True
def __repr__(self):
- return '<LockFile %s: %s [%s: %ssec] pid=%s>' % (
+ return '<LockFile %s: %s [%s: %s] pid=%s>' % (
id(self), self._lockfile,
self.locked() and 'locked' or 'unlocked',
self._lifetime, os.getpid())
@@ -400,7 +401,8 @@
return None
def _touch(self, filename=None):
- t = time.time() + self._lifetime
+ expiration_date = datetime.datetime.now() + self._lifetime
+ t = time.mktime(expiration_date.timetuple())
try:
# XXX We probably don't need to modify atime, but this is easier.
os.utime(filename or self._tmpfname, (t, t))
=== modified file 'Mailman/Message.py'
--- a/Mailman/Message.py 2007-08-01 20:11:08 +0000
+++ b/Mailman/Message.py 2007-08-01 21:05:06 +0000
@@ -253,7 +253,7 @@
reduced_list_headers=True,
)
if mlist is not None:
- enqueue_kws[listname] = mlist.fqdn_listname
+ enqueue_kws['listname'] = mlist.fqdn_listname
enqueue_kws.update(_kws)
virginq.enqueue(self, **enqueue_kws)
=== modified file 'Mailman/Queue/NewsRunner.py'
--- a/Mailman/Queue/NewsRunner.py 2007-08-01 20:11:08 +0000
+++ b/Mailman/Queue/NewsRunner.py 2007-08-01 21:05:06 +0000
@@ -138,7 +138,7 @@
hackmsgid = False
if hackmsgid:
del msg['message-id']
- msg['Message-ID'] = Utils.unique_message_id(mlist)
+ msg['Message-ID'] = email.utils.make_msgid()
# Lines: is useful
if msg['Lines'] is None:
# BAW: is there a better way?
=== modified file 'Mailman/docs/addresses.txt'
--- a/Mailman/docs/addresses.txt 2007-07-01 15:51:09 +0000
+++ b/Mailman/docs/addresses.txt 2007-08-01 21:05:06 +0000
@@ -124,7 +124,7 @@
>>> flush()
>>> print address_4.registered_on
None
- >>> print address_4.validated_on
+ >>> print address_4.verified_on
None
The registered date takes a Python datetime object.
@@ -134,16 +134,16 @@
>>> flush()
>>> print address_4.registered_on
2007-05-08 22:54:01
- >>> print address_4.validated_on
+ >>> print address_4.verified_on
None
And of course, you can also set the validation date.
- >>> address_4.validated_on = datetime(2007, 5, 13, 22, 54, 1)
+ >>> address_4.verified_on = datetime(2007, 5, 13, 22, 54, 1)
>>> flush()
>>> print address_4.registered_on
2007-05-08 22:54:01
- >>> print address_4.validated_on
+ >>> print address_4.verified_on
2007-05-13 22:54:01
=== modified file 'Mailman/docs/hold.txt'
--- a/Mailman/docs/hold.txt 2007-07-03 05:09:53 +0000
+++ b/Mailman/docs/hold.txt 2007-08-01 21:05:06 +0000
@@ -229,6 +229,7 @@
Traceback (most recent call last):
...
ImplicitDestination
+ >>> flush()
There should be two messages in the virgin queue, one to the list owner and
one to the original author.
@@ -352,10 +353,11 @@
... if mo:
... cookie = mo.group('cookie')
... break
- >>> data = mlist.pend_confirm(cookie)
- >>> data
- ('H', ...)
- >>> filename = '[EMAIL PROTECTED]' % data[1]
+ >>> from Mailman.interfaces import IPending
+ >>> data = IPending(config.db).confirm(cookie)
+ >>> sorted(data.items())
+ [('id', '...'), ('type', 'held message')]
+ >>> filename = '[EMAIL PROTECTED]' % data['id']
>>> heldmsg = os.path.join(config.DATA_DIR, filename)
Use helper function to read the held message.
=== modified file 'Mailman/docs/news-runner.txt'
--- a/Mailman/docs/news-runner.txt 2007-06-28 05:11:50 +0000
+++ b/Mailman/docs/news-runner.txt 2007-08-01 21:05:06 +0000
@@ -44,7 +44,7 @@
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Newsgroups: comp.lang.python
- Message-ID: <[EMAIL PROTECTED]>
+ Message-ID: ...
Lines: 1
<BLANKLINE>
A message
@@ -74,7 +74,7 @@
>>> print msg.as_string()
From: [EMAIL PROTECTED]
Newsgroups: comp.lang.python
- Message-ID: <[EMAIL PROTECTED]>
+ Message-ID: ...
Lines: 1
To: [EMAIL PROTECTED]
X-Original-To: [EMAIL PROTECTED]
@@ -109,7 +109,7 @@
Cc: [EMAIL PROTECTED]
Content-Transfer-Encoding: yes
Newsgroups: comp.lang.python
- Message-ID: <[EMAIL PROTECTED]>
+ Message-ID: ...
Lines: 1
<BLANKLINE>
A message
=== modified file 'Mailman/docs/pending.txt'
--- a/Mailman/docs/pending.txt 2007-08-01 20:11:08 +0000
+++ b/Mailman/docs/pending.txt 2007-08-01 21:05:06 +0000
@@ -15,7 +15,7 @@
In order to pend an event, you first need a pending database, which is
available by adapting the list manager.
- >>> pendingdb = IPending(config.list_manager)
+ >>> pendingdb = IPending(config.db)
>>> verifyObject(IPending, pendingdb)
True
--
(no title)
https://code.launchpad.net/~mailman-coders/mailman/3.0
You are receiving this branch notification because you are subscribed to it.
To unsubscribe from this branch go to
https://code.launchpad.net/~mailman-coders/mailman/3.0/+subscription/mailman-checkins.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org