[Mailman-Developers] Adding a new list attribute
Danci Emanuel
danci_emanuel at yahoo.com
Mon Jul 2 23:01:17 CEST 2012
Indeed, I added these values to the tables, so now they should be fine.
Still, now I am facing another problem. Although I suspected that in the
get_configuration() is the problem, now I cannot debug that because
now I get a new error. After adding the dlists_enabled field to the tables
and restaring mailman, when I try to access the Postorius server on
localhost:8000 I get the HTTP Error 500:
HTTP Error 500: A server error occurred. Please contact the administrator.
and is what shows up in the terminal when I try to access Postorious:
root at zalman:/usr/local/mm3/mailman# Traceback (most recent call last):
File "/usr/lib/python2.6/wsgiref/handlers.py", line 93, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/mm3/mailman/src/mailman/database/transaction.py", line 60, in wrapper
rtn = function(*args, **kws)
File "/usr/local/mm3/mailman/src/mailman/rest/wsgiapp.py", line 59, in __call__
environ, start_response)
File "/usr/local/mm3/mailman/eggs/restish-0.12.1-py2.6.egg/restish/app.py", line 18, in __call__
response = self.get_response(request, resource_or_response)
File "/usr/local/mm3/mailman/eggs/restish-0.12.1-py2.6.egg/restish/app.py", line 65, in get_response
resource_or_response = resource_or_response(request)
File "/usr/local/mm3/mailman/eggs/restish-0.12.1-py2.6.egg/restish/resource.py", line 212, in __call__
return _dispatch(request, match, lambda r: callable(self, r))
File "/usr/local/mm3/mailman/eggs/restish-0.12.1-py2.6.egg/restish/resource.py", line 243, in _dispatch
response = func(request)
File "/usr/local/mm3/mailman/eggs/restish-0.12.1-py2.6.egg/restish/resource.py", line 212, in <lambda>
return _dispatch(request, match, lambda r: callable(self, r))
File "/usr/local/mm3/mailman/src/mailman/rest/lists.py", line 202, in collection
resource = self._make_collection(request)
File "/usr/local/mm3/mailman/src/mailman/rest/helpers.py", line 140, in _make_collection
collection = self._get_collection(request)
File "/usr/local/mm3/mailman/src/mailman/rest/lists.py", line 119, in _get_collection
return list(getUtility(IListManager))
File "/usr/local/mm3/mailman/src/mailman/model/listmanager.py", line 90, in __iter__
for mlist in store.find(MailingList):
File "/usr/local/mm3/mailman/eggs/storm-0.19-py2.6-linux-i686.egg/storm/store.py", line 978, in __iter__
result = self._store._connection.execute(self._get_select())
File "/usr/local/mm3/mailman/eggs/storm-0.19-py2.6-linux-i686.egg/storm/database.py", line 238, in execute
raw_cursor = self.raw_execute(statement, params)
File "/usr/local/mm3/mailman/eggs/storm-0.19-py2.6-linux-i686.egg/storm/databases/sqlite.py", line 154, in raw_execute
return Connection.raw_execute(self, statement, params)
File "/usr/local/mm3/mailman/eggs/storm-0.19-py2.6-linux-i686.egg/storm/database.py", line 322, in raw_execute
self._check_disconnect(raw_cursor.execute, *args)
File "/usr/local/mm3/mailman/eggs/storm-0.19-py2.6-linux-i686.egg/storm/database.py", line 371, in _check_disconnect
return function(*args, **kwargs)
OperationalError: no such column: mailinglist.dlists_enabled
Indeed, is a pretty intuitive error but still, I did not manage to find the proper solution.
Thanks for your help and sorry for bugging you with so many questions, but I really
want to make this work as it should. :)
Thanks again,
Emanuel
________________________________
From: Danci Emanuel <danci_emanuel at yahoo.com>
To: "danci_emanuel at yahoo.com" <danci_emanuel at yahoo.com>
Sent: Monday, July 2, 2012 11:45 PM
Subject: asd
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
Emanuel DANCI
More information about the Mailman-Developers
mailing list