summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAurélien Bompard <aurelien@bompard.org>2013-10-15 11:44:35 +0200
committerAurélien Bompard <aurelien@bompard.org>2013-10-15 11:44:35 +0200
commit9e1bafebea58102e877df12932fd5b50362a7a2a (patch)
treea8829cb51b57b9ace0e962b06704259787ae1802
parent2175ec5205b68263b8e241fcf2fe450c5497f1b6 (diff)
downloadkittystore-9e1bafebea58102e877df12932fd5b50362a7a2a.tar.gz
kittystore-9e1bafebea58102e877df12932fd5b50362a7a2a.tar.xz
kittystore-9e1bafebea58102e877df12932fd5b50362a7a2a.zip
Store the archiving policy
-rw-r--r--kittystore/storm/model.py3
-rw-r--r--kittystore/storm/schema/__init__.py3
-rw-r--r--kittystore/storm/schema/patch_12.py6
-rw-r--r--kittystore/storm/store.py1
4 files changed, 13 insertions, 0 deletions
diff --git a/kittystore/storm/model.py b/kittystore/storm/model.py
index 72da88d..eb89186 100644
--- a/kittystore/storm/model.py
+++ b/kittystore/storm/model.py
@@ -19,6 +19,8 @@ from storm.locals import Unicode, RawStr, Int, ReferenceSet, Reference, Proxy
from storm.locals import Storm, Store
from storm.expr import Desc
from mailman.interfaces.messages import IMessage
+from mailman.interfaces.archiver import ArchivePolicy
+from mailman.database.types import Enum
from kittystore.utils import get_message_id_hash
from .hack_datetime import DateTime
@@ -44,6 +46,7 @@ class List(Storm):
name = Unicode(primary=True)
display_name = Unicode()
subject_prefix = Unicode()
+ archive_policy = Enum(ArchivePolicy)
def __init__(self, name):
self.name = unicode(name)
diff --git a/kittystore/storm/schema/__init__.py b/kittystore/storm/schema/__init__.py
index b966afd..8177707 100644
--- a/kittystore/storm/schema/__init__.py
+++ b/kittystore/storm/schema/__init__.py
@@ -8,6 +8,7 @@ CREATES = {
name VARCHAR(255) NOT NULL,
display_name TEXT,
subject_prefix TEXT,
+ archive_policy INTEGER,
PRIMARY KEY (name)
);""", """
CREATE TABLE "category" (
@@ -81,6 +82,7 @@ CREATES = {
name VARCHAR(255) NOT NULL,
display_name TEXT,
subject_prefix TEXT,
+ archive_policy INTEGER,
PRIMARY KEY (name)
);""", """
CREATE TABLE "category" (
@@ -165,6 +167,7 @@ CREATES = {
name VARCHAR(255) NOT NULL,
display_name TEXT,
subject_prefix TEXT,
+ archive_policy INTEGER,
PRIMARY KEY (name)
);""", """
CREATE TABLE `category` (
diff --git a/kittystore/storm/schema/patch_12.py b/kittystore/storm/schema/patch_12.py
new file mode 100644
index 0000000..1d3184d
--- /dev/null
+++ b/kittystore/storm/schema/patch_12.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+
+def apply(store):
+ """Add the list.archive_policy column"""
+ store.execute('ALTER TABLE list ADD COLUMN archive_policy INTEGER;')
+ store.commit()
diff --git a/kittystore/storm/store.py b/kittystore/storm/store.py
index 676f1af..e2e439c 100644
--- a/kittystore/storm/store.py
+++ b/kittystore/storm/store.py
@@ -96,6 +96,7 @@ class StormStore(object):
self.db.add(l)
l.display_name = mlist.display_name
l.subject_prefix = mlist.subject_prefix
+ l.archive_policy = mlist.archive_policy
if not message.has_key("Message-Id"):
raise ValueError("No 'Message-Id' header in email", message)
msg_id = unicode(unquote(message['Message-Id']))