Take a look at the doc string in the class definition of PropertyManager. It states that: An object may specify that it has one or more predefined properties, by specifying an _properties structure in its class:: _properties=({'id':'title', 'type': 'string', 'mode': 'w'}, {'id':'color', 'type': 'string', 'mode': 'w'}, ) The _properties structure is a sequence of dictionaries, where each dictionary represents a predefined property. Note that if a predefined property is defined in the _properties structure, you must provide an attribute with that name in your class or instance that contains the default value of the predefined property. Also take a look at some of the other products out there that have properties and you will see how they handle them. Don't forget to update any properties you have added in your manage_edit member function for example: self._updateProperty('cool',cool) Hope this helps, DR jesse wrote:
Hello, I recently created a product which adds a folder, with multiple dtmldocuments inside of it, effectivly creating a site immedatly. However, even though I can add folders and documents easiliy, I can't seem to create properties! It keeps giving me the Attribute error: aq_base. Here is the code for the function that does the work:
def manage_addMemberSite(self, id, title='',REQUEST=None): """Add a MemberSite folder."""
try: user=REQUEST['AUTHENTICATED_USER'] except: user=None
folder = MemberSite(id, title) # _setObject must be the Zope hook that actually stores this instance in # the ZODB self._setObject(id, folder)
folder.manage_addFolder(id='Images', title='') folder.manage_addDTMLDocument(id='index_html', title='', file=index_body) folder.manage_addDTMLDocument(id='navbar', title='', file=navbar_html) folder.manage_addDTMLDocument(id='content', title='enter page content here', file=default_dd_html)
folder.manage_addProperty(id='nav_color', value='#483D8B', type='string') folder.manage_addProperty(id='content_color', value='#F0E68C', type='string') folder.manage_addProperty(id='background_color', value='#FFFFFF', type='string')
if REQUEST: return self.manage_main(self, REQUEST, update_menu=1)
The folder.manage_addProperty(id etc etc) does not work. I have been looking all over, have looked to where the error seems to stem from, (the valid_property_id function in the PropertyManager.py) but I can't seem to find out whats wrong. Does anyone have any ideas?
Please respond ASAP.
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )