From f321d85d91a370294e771dbaa22493008d78dfdd Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Wed, 31 Oct 2007 17:38:51 -0400 Subject: Much progress, though not perfect, on migrating to SQLAlchemy 0.4 and Elixir 0.4. Lots of things changes, which broke lots of our code. There are still a couple of failures in the test suite that I don't understand. It seems that for pending.txt and requests.txt, sometimes strings come back from the database as 8-bit strings and other times as unicodes. It's impossible to make these tests work both separately and together. users.txt is also failing intermittently. Lots of different behavior between running the full test suite all together and running individual tests. Sigh. Note also that actually, Elixir 0.4.0 doesn't work for us. There's a bug in that version that prevented zope.interfaces and Elixir working together. Get the latest 0.4.0 from source to fix this. Other changes include: - Remove Mailman/lockfile.py. While I haven't totally eliminated locking, I have released the lockfile as a separate Python package called locknix, which Mailman 3.0 now depends on. - Renamed Mailman/interfaces/messagestore.py and added an IMessage interface. - bin/testall raises turns on SQLALCHEMY_ECHO when the verbosity is above 3 (that's three -v's because the default verbosity is 1). - add_domain() in config files now allows url_host to be optional. If not given, it defaults to email_host. - Added a non-public interface IDatabase._reset() used by the test suite to zap the database between doctests. Added an implementation in the model which just runs through all rows in all entities, deleting them. - [I]Pending renamed to [I]Pended - Don't allow Pendings.add() to infloop. - In the model's User impelementations, we don't need to append or remove the address when linking and unlinking. By setting the address.user attribute, SQLAlchemy appears to do the right thing, though I'm not 100% sure of that (see the above mentioned failures). --- Mailman/Handlers/Scrubber.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'Mailman/Handlers/Scrubber.py') diff --git a/Mailman/Handlers/Scrubber.py b/Mailman/Handlers/Scrubber.py index 3f29fc02b..bb607b1d2 100644 --- a/Mailman/Handlers/Scrubber.py +++ b/Mailman/Handlers/Scrubber.py @@ -29,12 +29,12 @@ import binascii import tempfile from cStringIO import StringIO -from mimetypes import guess_all_extensions - from email.charset import Charset from email.generator import Generator from email.parser import HeaderParser from email.utils import make_msgid, parsedate +from locknix.lockfile import Lock +from mimetypes import guess_all_extensions from Mailman import Message from Mailman import Utils @@ -42,7 +42,6 @@ from Mailman.Errors import DiscardMessage from Mailman.app.archiving import get_base_archive_url from Mailman.configuration import config from Mailman.i18n import _ -from Mailman.lockfile import LockFile # Path characters for common platforms pre = re.compile(r'[/\\:]') @@ -424,7 +423,7 @@ def save_attachment(mlist, msg, dir, filter_html=True): ext = '.bin' path = None # We need a lock to calculate the next attachment number - with LockFile(os.path.join(fsdir, 'attachments.lock')): + with Lock(os.path.join(fsdir, 'attachments.lock')): # Now base the filename on what's in the attachment, uniquifying it if # necessary. if not filename or config.SCRUBBER_DONT_USE_ATTACHMENT_FILENAME: -- cgit v1.2.3-70-g09d2