From 46f480dfaa6286ff8950af817de1c35910b37e16 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sun, 4 Nov 2007 18:10:21 -0500 Subject: Target Mailman onto the Storm Python ORM. This enables a few interesting things: 1. It makes it easier to do our "pillars of storage" idea, where list data and messages could live in one database, but user information live in a separate database. 2. It reduces the number of moving parts. SQLAlchemy and Elixir can both go away in favor of just one database layer. 3. No more Unicode/string mush hell. Somewhere along the way the upgrade to SQLAlchemy 0.4 and Elixir 0.4 made the strings coming out the database sometimes Unicode and sometimes 8-bit. This was totally unpredictable. Storm asserts that if a property is declared Unicode, it comes in and goes out as Unicode. 4. 'flush' is gone. One cost of this is that Storm does not yet currently support schema generation. So I cheat by dumping the trunk's SQLite schema and using that as a starting place for the Storm-based schema. I hope that Storm will eventually address this. Other related changes include: - SQLALCHEMY_ENGINE_URL is renamed to DEFAULT_DATABASE_URL. This may still get changed. Things I still want to fix: - Ickyness with clearing the databases. - Really implement multiple stores with better management of the Store instances. - Fix all the circular import nasties. --- Mailman/tests/test_documentation.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'Mailman/tests/test_documentation.py') diff --git a/Mailman/tests/test_documentation.py b/Mailman/tests/test_documentation.py index d8578bd05..c6ba0a1d6 100644 --- a/Mailman/tests/test_documentation.py +++ b/Mailman/tests/test_documentation.py @@ -22,8 +22,11 @@ import pdb import doctest import unittest +from email import message_from_string + import Mailman +from Mailman.Message import Message from Mailman.app.styles import style_manager from Mailman.configuration import config from Mailman.database import flush @@ -32,6 +35,17 @@ from Mailman.database import flush COMMASPACE = ', ' + +def specialized_message_from_string(string): + return message_from_string(string, Message) + + +def setup(testobj): + """Set up some things for convenience.""" + testobj.globs['config'] = config + testobj.globs['message_from_string'] = specialized_message_from_string + + def cleaning_teardown(testobj): """Clear all persistent data at the end of a doctest.""" @@ -69,6 +83,7 @@ def test_suite(): 'docs/' + filename, package=Mailman, optionflags=flags, + setUp=setup, tearDown=cleaning_teardown) suite.addTest(test) return suite -- cgit v1.2.3-70-g09d2