~abompard/mailman/bug-1312884

« back to all changes in this revision

Viewing changes to src/mailman/model/preferences.py

  • Committer: Barry Warsaw
  • Date: 2014-11-01 16:49:15 UTC
  • mfrom: (7251.1.38 abhilash)
  • Revision ID: barry@list.org-20141101164915-06wqfmya6wf47n6n
Database
--------
 * The ORM layer, previously implemented with Storm, has been replaced by
   SQLAlchemy, thanks to the fantastic work by Abhilash Raj and Aurélien
   Bompard.  Alembic is now used for all database schema migrations.
 * The new logger `mailman.database` logs any errors at the database layer.

API
---
 * Several changes to the internal API:
   - `IListManager.mailing_lists` is guaranteed to be sorted in List-ID order.
   - `IDomains.mailing_lists` is guaranteed to be sorted in List-ID order.
   - Iteration over domains via the `IDomainManager` is guaranteed to be sorted
     by `IDomain.mail_host` order.
   - `ITemporaryDatabase` interface and all implementations are removed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    ]
26
26
 
27
27
 
28
 
from storm.locals import Bool, Int, Unicode
 
28
from sqlalchemy import Boolean, Column, Integer, Unicode
29
29
from zope.component import getUtility
30
30
from zope.interface import implementer
31
31
 
41
41
class Preferences(Model):
42
42
    """See `IPreferences`."""
43
43
 
44
 
    id = Int(primary=True)
45
 
    acknowledge_posts = Bool()
46
 
    hide_address = Bool()
47
 
    _preferred_language = Unicode(name='preferred_language')
48
 
    receive_list_copy = Bool()
49
 
    receive_own_postings = Bool()
50
 
    delivery_mode = Enum(DeliveryMode)
51
 
    delivery_status = Enum(DeliveryStatus)
 
44
    __tablename__ = 'preferences'
 
45
 
 
46
    id = Column(Integer, primary_key=True)
 
47
    acknowledge_posts = Column(Boolean)
 
48
    hide_address = Column(Boolean)
 
49
    _preferred_language = Column('preferred_language', Unicode)
 
50
    receive_list_copy = Column(Boolean)
 
51
    receive_own_postings = Column(Boolean)
 
52
    delivery_mode = Column(Enum(DeliveryMode))
 
53
    delivery_status = Column(Enum(DeliveryStatus))
52
54
 
53
55
    def __repr__(self):
54
56
        return '<Preferences object at {0:#x}>'.format(id(self))