Revision: 8063
          http://svn.sourceforge.net/mailman/?rev=8063&view=rev
Author:   mindlace23
Date:     2006-10-14 14:48:37 -0700 (Sat, 14 Oct 2006)

Log Message:
-----------
redid table_schema to allow metadata to be reused, started object_mappers to 
provide objects

Modified Paths:
--------------
    branches/soc2006-webui/Mailman/DB/table_schema.py
    branches/soc2006-webui/XUI/setup.py
    branches/soc2006-webui/XUI/xui/templates/content.html

Added Paths:
-----------
    branches/soc2006-webui/Mailman/DB/object_mappers.py

Removed Paths:
-------------
    branches/soc2006-webui/wingide.wpr

Added: branches/soc2006-webui/Mailman/DB/object_mappers.py
===================================================================
--- branches/soc2006-webui/Mailman/DB/object_mappers.py                         
(rev 0)
+++ branches/soc2006-webui/Mailman/DB/object_mappers.py 2006-10-14 21:48:37 UTC 
(rev 8063)
@@ -0,0 +1,52 @@
+from sqlalchemy import *
+
+"""Data mappers providing object-oriented access to the schema."""
+
+class User(object):
+    pass
+
+class List(object):
+    """opaque key = KEY, lower-cased email address = LCE, case-preserved email 
= CPE"""
+    
+    def getMembers(self):
+        """Get the LCE for all the members of the mailing list."""
+        raise NotImplementedError
+
+    def getRegularMemberKeys(self):
+        """Get the LCE for all regular delivery members (i.e. non-digest)."""
+        raise NotImplementedError
+
+    def getDigestMemberKeys(self):
+        """Get the LCE for all digest delivery members."""
+        raise NotImplementedError
+
+    def isMember(self, member):
+        """Return 1 if member KEY/LCE is a valid member, otherwise 0."""
+
+    def getMemberKey(self, member):
+        """Return the KEY for the member KEY/LCE.
+
+        If member does not refer to a valid member, raise NotAMemberError.
+        """
+        raise NotImplementedError
+
+    def getMemberCPAddress(self, member):
+        """Return the CPE for the member KEY/LCE.
+
+        If member does not refer to a valid member, raise NotAMemberError.
+        """
+        raise NotImplementedError
+
+    def getMemberCPAddresses(self, members):
+        """Return a sequence of CPEs for the given sequence of members.
+
+        The returned sequence will be the same length as members.  If any of
+        the KEY/LCEs in members does not refer to a valid member, that entry
+        in the returned sequence will be None (i.e. NotAMemberError is never
+        raised).
+        """
+        raise NotImplementedError
+
+
+class Domain(object):
+    pass
\ No newline at end of file

Modified: branches/soc2006-webui/Mailman/DB/table_schema.py
===================================================================
--- branches/soc2006-webui/Mailman/DB/table_schema.py   2006-10-14 02:03:42 UTC 
(rev 8062)
+++ branches/soc2006-webui/Mailman/DB/table_schema.py   2006-10-14 21:48:37 UTC 
(rev 8063)
@@ -7,84 +7,102 @@
     supposedly uuidgen is common on unix systems, replace me for windows 
support"""
     return commands.getoutput('uuidgen')
     
+class DB(object):
+    def __init__(self,db='sqlite:///mailman.db'):
+        self.engine = create_engine(db)
+        self.metadata = BoundMetaData(db)
+        self.atom = Table('atom',self.metadata,
+                           
Column('uuid',String(36),primary_key=True,default=uuidgen),
+                           Column('type',Integer,ForeignKey('atom_type.id'))
+                           )
 
-db = create_engine('sqlite:///mailman.db')
-
-metadata = BoundMetaData(db)
-
-"""The primary justification for using UUIDs is so that two mailman 
installations
-   can be merged without excessive pain; they also allow unambiguous typeless 
references"""
-
-user_uuid = Table('user_uuid',metadata,
-                   Column('id',String(36),primary_key=True,default=uuidgen)
-                   )
-
-email_address = Table('email_address', metadata,
-                    Column('user_id', String(36), ForeignKey('user_uuid.id')),
-                    Column('string',Unicode(255),unique=True)
-                    )
-
-username = Table('username', metadata,
-                Column('user_id', String(36), ForeignKey('user_uuid.id'), 
primary_key=True),
+        self.atom_type = Table('atom_type',self.metadata,
+                           Column('id',Integer,primary_key=True),
+                           Column('name',String(20),unique=True,nullable=False)
+                           )
+        self.email_address = Table('email_address', self.metadata,
+                            Column('user_uuid', String(36), 
ForeignKey('atom.uuid')),
+                            Column('string',Unicode(255),unique=True)
+                            )
+        self.username = Table('username', self.metadata,
+                Column('user_uuid', String(36), ForeignKey('atom.uuid'), 
primary_key=True),
                 Column('string',Unicode(255),primary_key=True)
                 )
-
-password = Table('password', metadata,
-                    Column('user_id', String(36), 
ForeignKey('user_uuid.id'),primary_key=True),
-                    Column('string',Unicode(50))
-                )
-
-access = Table('access',metadata,
-                     Column('level',Integer,ForeignKey('access_level_type.id') 
),
-                     Column('holder',String(36), ForeignKey('uuid.id'), 
nullable=False),
-                     Column('context',String(36)),
-                     )
-access_level_type = Table('access_level_type',metadata,
+        self.password = Table('password', self.metadata,
+                            Column('user_uuid', String(36), 
ForeignKey('atom.uuid'),primary_key=True),
+                            Column('string',Unicode(50))
+                        )
+        self.access = Table('access', self.metadata,
+                             
Column('level',Integer,ForeignKey('access_level_type.id') ),
+                             Column('holder',String(36), 
ForeignKey('atom.uuid'), nullable=False),
+                             Column('context',String(36), 
ForeignKey('atom.uuid')),
+                             ) 
+        self.access_level_type = Table('access_level_type',self.metadata,
                           Column('id',Integer,primary_key=True),
                           Column('name',String(20),nullable=False,unique=True),
                           )
-
-access_level_types = {0:'anonymous',
-                    1:'authenticated',
-                    2:'member',
-                    3:'moderator',
-                    4:'administrator'}
-
-domain = Table('domain',metadata,
-               Column('id',String(36), default=uuidgen, primary_key=True),
+        self.domain = Table('domain',self.metadata,
+               Column('uuid',String(36), ForeignKey('atom.uuid')),
                Column('name',Unicode(255)),
                )
-
-list = Table('list',metadata,
-             Column('id',String(36), default=uuidgen, primary_key=True),
+        self.list = Table('list',self.metadata,
+             Column('id',String(36), ForeignKey('atom.uuid')),
              Column('real_name',Unicode(255),nullable = False),
              )
-
-setting = Table('setting',metadata,
-                Column('id', String(36), default=uuidgen, primary_key=True),
-                Column('applied_to',String(36)),
+        self.setting = Table('setting',self.metadata,
+                Column('uuid', String(36), ForeignKey('atom.uuid'), 
primary_key=True),
+                Column('applied_to',String(36),ForeignKey('atom.uuid') ),
                 Column('type',String(36),ForeignKey('setting_type.name') ),
                 Column('boolean_value',Boolean),
                 Column('integer_value',Integer),
                 Column('float_value',Float),
-                Column('text_value',Varchar),
-                Column('applied_by',String(36), ForeignKey('user_uuid.id') ),
-                Column('applied_date',TIMESTAMP),
+                Column('text_value',TEXT),
+                Column('applied_by',String(36), ForeignKey('atom.uuid') ),
+                Column('applied_at',TIMESTAMP),
                 )
-
-"""probably be good to add some stuff to this... validators/etc?"""
-setting_type = Table('setting_type',metadata,
+        self.setting_type = Table('setting_type',self.metadata,
+                     Column('id',Integer, primary_key=True),
                      Column('name', String(36), primary_key=True),
                      )
 
-past_setting = Table('past_setting',metadata,
-                Column('id', String(36), primary_key=True),
-                Column('applied_to',String(36)),
-                Column('type',String(36),ForeignKey('setting_type.name') ),
-                Column('boolean_value',Boolean),
-                Column('integer_value',Integer),
-                Column('float_value',Float),
-                Column('text_value',Varchar),
-                Column('applied_by',String(36), ForeignKey('user_uuid.id') ),
-                Column('applied_date',TIMESTAMP),
-                ) 
\ No newline at end of file
+        self.setting_past = Table('past_setting',self.metadata,
+                        Column('uuid', String(36), ForeignKey('atom.uuid'), 
primary_key=True),
+                        Column('applied_to',String(36),ForeignKey('atom.uuid') 
),
+                        
Column('type',String(36),ForeignKey('setting_type.name') ),
+                        Column('boolean_value',Boolean),
+                        Column('integer_value',Integer),
+                        Column('float_value',Float),
+                        Column('text_value',TEXT),
+                        Column('applied_by',String(36), 
ForeignKey('atom.uuid') ),
+                        Column('applied_at',TIMESTAMP),
+                        )
+        
+    def create(self):
+        atom_types = ({'id':0,'name':'user'},
+              {'id':1,'name':'list'},
+              {'id':2,'name':'domain'},
+              {'id':3,'name':'setting'},
+              )
+
+        access_level_types = ({'id':0,'name':'anonymous'},
+                      {'id':1,'name':'authenticated'},
+                      {'id':2,'name':'member'},
+                      {'id':3,'name':'moderator'},
+                      {'id':4,'name':'administrator'},
+                      )
+
+        self.atom_type.create()
+        self.atom_type.insert().execute(atom_types)
+        self.atom.create()
+        self.email_address.create()
+        self.username.create()
+        self.password.create()
+        self.access_level_type.create()
+        self.access_level_type.insert().execute(access_level_types)
+        self.access.create()
+        self.setting_type.create()
+        self.setting.create()
+        self.setting_past.create()
+        
+if __name__ == '__main__':
+    DB().create()
\ No newline at end of file

Modified: branches/soc2006-webui/XUI/setup.py
===================================================================
--- branches/soc2006-webui/XUI/setup.py 2006-10-14 02:03:42 UTC (rev 8062)
+++ branches/soc2006-webui/XUI/setup.py 2006-10-14 21:48:37 UTC (rev 8063)
@@ -21,7 +21,8 @@
         'Genshi',
         'PasteScript',
         'PasteDeploy',
-        'Paste'
+        'Paste',
+        'simplejson',
     ],
     entry_points="""
         [paste.app_factory]

Modified: branches/soc2006-webui/XUI/xui/templates/content.html
===================================================================
--- branches/soc2006-webui/XUI/xui/templates/content.html       2006-10-14 
02:03:42 UTC (rev 8062)
+++ branches/soc2006-webui/XUI/xui/templates/content.html       2006-10-14 
21:48:37 UTC (rev 8063)
@@ -10,7 +10,7 @@
     <title py:strip="">generic title</title>
 </head>
 <body>
-               <!--! all posts go to the same post controller -->
+       <!--! all posts go to the same post controller -->
     <form method="post" action="post">
         <!--! The "main body" of the page -->
         <div id="body">

Deleted: branches/soc2006-webui/wingide.wpr
===================================================================
--- branches/soc2006-webui/wingide.wpr  2006-10-14 02:03:42 UTC (rev 8062)
+++ branches/soc2006-webui/wingide.wpr  2006-10-14 21:48:37 UTC (rev 8063)
@@ -1,46 +0,0 @@
-#!wing
-#!version=2.0
-##################################################################
-# Wing IDE project file                                          #
-##################################################################
-[project attributes]
-proj.file-list = [loc('XUI/docs/devel_config.ini'),
-                  loc('XUI/setup.cfg'),
-                  loc('XUI/setup.py'),
-                  loc('XUI/utils/.change_passwords.py.swp'),
-                  loc('XUI/utils/change_passwords.py'),
-                  loc('XUI/xui/markup_extensions.py'),
-                  loc('XUI/xui/sitepage.py'),
-                  loc('XUI/xui/static/global.css'),
-                  loc('XUI/xui/templates/content.html'),
-                  loc('XUI/xui/templates/fragments/enter_email.html'),
-                  loc('XUI/xui/templates/fragments/null.html'),
-                  loc('XUI/xui/templates/fragments/__init__.py'),
-                  loc('XUI/xui/templates/piece.html'),
-                  loc('XUI/xui/templates/pieces/controls.html'),
-                  loc('XUI/xui/templates/pieces/deliveryswitch.html'),
-                  loc('XUI/xui/templates/pieces/digestmode.html'),
-                  loc('XUI/xui/templates/pieces/duplicateswitch.html'),
-                  loc('XUI/xui/templates/pieces/emailfeedback.html'),
-                  loc('XUI/xui/templates/pieces/headerfilter.html'),
-                  loc('XUI/xui/templates/pieces/language.html'),
-                  loc('XUI/xui/templates/pieces/list.html'),
-                  loc('XUI/xui/templates/pieces/lists.html'),
-                  loc('XUI/xui/templates/pieces/lost_password.html'),
-                  loc('XUI/xui/templates/pieces/navigation.html'),
-                  loc('XUI/xui/templates/pieces/ownership_passwords.html'),
-                  loc('XUI/xui/templates/pieces/passwordchange.html'),
-                  loc('XUI/xui/templates/pieces/replyto.html'),
-                  loc('XUI/xui/templates/pieces/showsubscribed.html'),
-                  loc('XUI/xui/templates/pieces/signin.html'),
-                  loc('XUI/xui/templates/pieces/topicsubscription.html'),
-                  loc('XUI/xui/templates/pieces/umbrella.html'),
-                  loc('XUI/xui/templates/pieces/unsubscribe.html'),
-                  loc('XUI/xui/templates/pieces/__init__.py'),
-                  loc('XUI/xui/templates/__init__.py'),
-                  loc('XUI/xui/web/environ.py'),
-                  loc('XUI/xui/web/index.py'),
-                  loc('XUI/xui/web/__init__.py'),
-                  loc('XUI/xui/wsgiapp.py'),
-                  loc('XUI/xui/__init__.py')]
-proj.file-type = 'shared'


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to