[Mailman-Developers] Adding a new list attribute

Barry Warsaw barry at python.org
Mon Jul 2 17:55:15 CEST 2012


On Jul 01, 2012, at 02:54 PM, Danci Emanuel wrote:

>Secondly, I tried to modify the list attributes by adding the following: 
>
>dlists_enabled = Attribute("""Is the Dynamic sublist feature enabled?""") -
>"IMailingList" interface (/interfaces/mailinglist.py) dlists_enabled = Bool()
>-  "MailingList" class (/model/mailinglist.py)

If you want this value to persist, it must also be added to the SQL tables,
e.g. sqlite.sql and/or postgres.sql.  This will make your schema incompatible
with upstream Mailman, and there will be a better way to extend the default
schema in the future, but for now, this should be enough to get you going
again.

Of course, it's not necessary to store your data in the primary database.
Once you've got a REST API for your stuff, you can really map this to any
backend storage you want.

>dlists_enabled = GetterSetter(as_boolean) - to the ATTRIBUTES dict from
>/rest/configuration.py
>
>mlist.dlists_enabled = True - in the "apply" method from "DefaultStyle" class
>(/styles/default.py)
>
>Obviously I did something wrong, or I did not add all the necessary changes
>because when I try to create a new lists that has the dlists feature enabled,
>I get the HTTP Error 400: 
>
>HTTP Error 400: Unknown attribute: dlists_enabled

That error gets thrown on line 233 of configuration.py and it only happens if
the attribute name isn't found in ATTRIBUTES.  Probably the best way to debug
this is to set a break point in get_configuration() and step through it when
self._attribute == 'dlist_enabled'.

Cheers,
-Barry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/mailman-developers/attachments/20120702/eec08770/attachment.pgp>


More information about the Mailman-Developers mailing list