[Zope] Creating a New Object Type - Use ZClass or Python?

Anthony Pfrunder s341625@student.uq.edu.au
Fri, 30 Jul 1999 21:34:59 +1000 (GMT+1000)


On Fri, 30 Jul 1999, eric jones wrote:

[snip]
> I'd like the Add form to have places for adding all the basic properties.
> The paper title, journal name, and description are pretty straight forward I
> think.  The authors are a little more troubling.  I'd like to make them a
> list of tuples:
[snip, snip]

In my opinion Zclasses are _far_ easier than Python, also, you can edit it
on the fly and watch the changes in real-time.  WRT your application, I
suggest that you create a Zclass which subclasses XML Document.  Put the
instance within a Zcatalog search folder. Zcatalog
is the bit that adds searching (see zope list for an
example from the kind DC souls...) and XML allows you to create a
structured document with your own tags.  My guess (ie haven't tried it) is
that Zcatalog can be made to index on the properties exposed by XML and
then you can index on Author and create an appropiate sequence of results
as required.

To add authors, you could use a select list with a New and Delete buttons
(New adds the author to the list & reloads).  XML can handle recursive
structures:

	<Record>
	  <title>Zope: Authoring a Better Way</title>
	  <Description>some xhtml stuff...</Description>
	  <Author>Mr Zippy</Author>
	  <Author>Mr Zope</Author>
	</Record>

http://something.com/Record/4/ = Mr Zope

So, create a Zclass which inputs the info and outputs an XML doc.  Then,
make Zcatalog index it on Author.  The www.w3.org website has further
excellent information on the uses of XML.

Cheers,

Anthony Pfrunder
Zope Community Partner