summaryrefslogtreecommitdiff
path: root/Mailman/interfaces
diff options
context:
space:
mode:
authorBarry Warsaw2007-10-31 17:38:51 -0400
committerBarry Warsaw2007-10-31 17:38:51 -0400
commitf321d85d91a370294e771dbaa22493008d78dfdd (patch)
tree8cf4c3e7cab70ccc9059f147ff1bf4b3bf150115 /Mailman/interfaces
parent1ad73a52bb9d82ef3af1e34ad9ef66ac2eda2909 (diff)
downloadmailman-f321d85d91a370294e771dbaa22493008d78dfdd.tar.gz
mailman-f321d85d91a370294e771dbaa22493008d78dfdd.tar.zst
mailman-f321d85d91a370294e771dbaa22493008d78dfdd.zip
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).
Diffstat (limited to 'Mailman/interfaces')
-rw-r--r--Mailman/interfaces/database.py16
-rw-r--r--Mailman/interfaces/languages.py7
-rw-r--r--Mailman/interfaces/messages.py (renamed from Mailman/interfaces/messagestore.py)11
-rw-r--r--Mailman/interfaces/pending.py22
4 files changed, 52 insertions, 4 deletions
diff --git a/Mailman/interfaces/database.py b/Mailman/interfaces/database.py
index 23405b9e8..f4dd693a4 100644
--- a/Mailman/interfaces/database.py
+++ b/Mailman/interfaces/database.py
@@ -30,12 +30,24 @@ from zope.interface import Interface, Attribute
class IDatabase(Interface):
"""Database layer interface."""
- def initialize():
- """Initialize the database layer, using whatever means necessary."""
+ def initialize(debug=None):
+ """Initialize the database layer, using whatever means necessary.
+
+ :param debug: When None (the default), the configuration file
+ determines whether the database layer should have increased
+ debugging or not. When True or False, this overrides the
+ configuration file setting.
+ """
def flush():
"""Flush current database changes."""
+ def _reset():
+ """Reset the database to its pristine state.
+
+ This is only used by the test framework.
+ """
+
# XXX Eventually we probably need to support a transaction manager
# interface, e.g. begin(), commit(), abort(). We will probably also need
# to support a shutdown() method for cleanly disconnecting from the
diff --git a/Mailman/interfaces/languages.py b/Mailman/interfaces/languages.py
index b9ddd8c90..84663cd89 100644
--- a/Mailman/interfaces/languages.py
+++ b/Mailman/interfaces/languages.py
@@ -71,3 +71,10 @@ class ILanguageManager(Interface):
enabled_names = Attribute(
"""An iterator over all enabled language names.""")
+
+
+
+class ILanguage(Interface):
+ """The representation of a language."""
+
+ code = Attribute("""The 2-character language code.""")
diff --git a/Mailman/interfaces/messagestore.py b/Mailman/interfaces/messages.py
index 541238fd1..9fac98d76 100644
--- a/Mailman/interfaces/messagestore.py
+++ b/Mailman/interfaces/messages.py
@@ -99,3 +99,14 @@ class IMessageStore(Interface):
messages = Attribute(
"""An iterator over all messages in this message store.""")
+
+
+
+class IMessage(Interface):
+ """The representation of an email message."""
+
+ hash = Attribute("""The unique SHA1 hash of the message.""")
+
+ path = Attribute("""The filesystem path to the message object.""")
+
+ message_id = Attribute("""The message's Message-ID header.""")
diff --git a/Mailman/interfaces/pending.py b/Mailman/interfaces/pending.py
index 68a4c41de..22d18a07c 100644
--- a/Mailman/interfaces/pending.py
+++ b/Mailman/interfaces/pending.py
@@ -40,10 +40,28 @@ class IPendable(Interface):
Both the keys and values must be strings.
"""
-
+
+
+
+class IPended(Interface):
+ """A pended event, tied to a token."""
+
+ token = Attribute("""The pended token.""")
+
+ expiration_date = Attribute("""The expiration date of the pended event.""")
+
+
+
+class IPendedKeyValue(Interface):
+ """A pended key/value pair."""
+
+ key = Attribute("""The pended key.""")
+
+ value = Attribute("""The pended value.""")
+
-class IPending(Interface):
+class IPendings(Interface):
"""Interface to pending database."""
def add(pendable, lifetime=None):