Author: robin.munn
Date: Mon Mar 21 15:00:40 2005
New Revision: 49

Modified:
   trunk/mailman/src/mailman/database/schema.py
   trunk/mailman/src/mailman/database/tests/test_attribute.py
Log:
New test case to guarantee that list styles trump domain styles.
Also removed "alternateID=True" from the definition of the name
column in AttributeValue: alternateID is for cases where that column
will be UNIQUE, and AttributeValue is *meant* to contain multiple
rows with the same attribute name (and different group ID's).


Modified: trunk/mailman/src/mailman/database/schema.py
==============================================================================
--- trunk/mailman/src/mailman/database/schema.py        (original)
+++ trunk/mailman/src/mailman/database/schema.py        Mon Mar 21 15:00:40 2005
@@ -229,7 +229,7 @@
 class AttributeValue(SQLObject):
     _cacheValue     = False
     # Attributes
-    name            = UnicodeCol(alternateID=True)
+    name            = UnicodeCol()
     group           = ForeignKey('AttributeGroup')
     value           = UnicodeCol()
     policy          = EnumCol(enumValues=['LOCKED', 'ADVANCED', 'BASIC'])

Modified: trunk/mailman/src/mailman/database/tests/test_attribute.py
==============================================================================
--- trunk/mailman/src/mailman/database/tests/test_attribute.py  (original)
+++ trunk/mailman/src/mailman/database/tests/test_attribute.py  Mon Mar 21 
15:00:40 2005
@@ -97,6 +97,28 @@
         fetched_value = list_style.get_value('enable_archives')
         eq(fetched_value, 'False')
 
+    def test_list_style_trumps_domain_style(self):
+        eq = self.assertEqual
+        attr = schema.Attribute(name='enable_archives',
+                                type='BOOL',
+                                default_value='True')
+        domain_group = schema.AttributeGroup(collection_name='domain_options')
+        domain_value = schema.AttributeValue(name='enable_archives',
+                                             group=domain_group,
+                                             value='Should not see this',
+                                             policy='BASIC')
+        domain_style = schema.ListStyle(name='lists.com')
+        domain_style.addAttributeGroup(domain_group)
+        list_group = schema.AttributeGroup(collection_name='list_options')
+        list_value = schema.AttributeValue(name='enable_archives',
+                                           group=list_group,
+                                           value='False',
+                                           policy='BASIC')
+        list_style = schema.ListStyle(name='[EMAIL PROTECTED]')
+        list_style.addAttributeGroup(list_group)
+        fetched_value = list_style.get_value('enable_archives')
+        eq(fetched_value, list_value.value)
+
 
 
 def test_suite():
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to