[ZWeb] Zope.org feedback: [Documentation patch] Build a simple ZClass (CatalogAware, non-default Catalog, Folderish)
Chui Tey
teyc@cognoware.com
Thu, 31 Jan 2002 17:29:18 -0500
1. def_index should be placed in the Talkback folder, not the tbContainer folder.
2. tbContainer_add (PythonScript version)
URL1=REQUEST.URL1
RESPONSE=REQUEST.response
new_container = script.tbContainer.createInObjectManager(REQUEST['id'], REQUEST)
new_catalog = new_container.manage_addProduct['ZCatalog'].manage_addZCatalog('tbCatalog')
new_container.zcatalog.manage_delColumn('summary')
new_container.zcatalog.manage_addColumn('username')
new_container.zcatalog.manage_addColumn('bodytext')
new_container.zcatalog.manage_addColumn('email')
new_container.zcatalog.manage_addIndex('username','FieldIndex')
new_container.manage_addDTMLMethod('index_html', '', script.def_index)
if hasattr(REQUEST,'DestinationURL'):
RESPONSE.redirect(REQUEST.DestinationURL+'/manage_workspace')
else:
RESPONSE.redirect(REQUEST.URL2+'/manage_workspace')
3. tbEntry_add (Pythonscript version)
new_id=str(context.ZopeTime().strftime('%Y%m%d%H%M%S'))
new_entry=container.tbEntry.createInObjectManager(new_id, REQUEST)
new_entry.propertysheets.tbProperty.manage_editProperties(REQUEST)
#
# Notify the entry to use a catalog called zcatalog.
# (by default, CatalogAware instances catalog themselves in a catalog
# called Catalog
#
new_entry.manage_editCataloger('tbCatalog')
new_entry.reindex_object()
RESPONSE=REQUEST.response
if getattr(REQUEST,'DestinationURL',''):
RESPONSE.redirect(REQUEST.DestinationURL+'/manage_workspace')
else:
RESPONSE.redirect(REQUEST.URL1+'/manage_workspace')
----------------------------------------------------------
This email was generated from the Zope.org feedback form
It was invoked from a link on http://www.zope.org/Members/kedai/BuildSimpleZClass