Creating a New Object Type - Use ZClass or Python?
Hello, Forgive me if this is a double post - I sent it to zope@egroups.com , and it never appeared in the posts as far as I could tell. I'm pretty comfortable with Python, but new to Zope. We're trying to figure out the best way to set up an academic web site that has a list of publications on it. Each publication has several authors, a description, etc. It will also have a pdf and perhaps a postcript copy of the article. We need to be able to search the author list. I'd like to create a PubClass that, when it displays itself looks like: "Some silly paper" IEEE Trans. on Antennas and Propagation Description: Some rubbish about how great the silly paper is. Authors: Eric Jones, Larry Carin, William Joines PDF: link_to_pdf_file_object (size) PS: link_to_ps_file_object (size) 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: [ (first_name,last_name), (first_name,last_name),...] to facilitate searching for a particular author (so that only Larry Carin's papers are displayed on his page). Is there a way to do this sort of thing with ZClasses? Also, I want the Add form to have places to browse for the pdf and ps files - much like a Zope File object - and then add these files to the PubClass object. Is this best done by creating a class in python or with the ZClass interface? thanks, eric
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
Thanks for all the responses. He he... I should have known better, though. Of the first three responses from Anthony, Michel, and Kevin, I got 3 totally different responses. If I had known more about XML, I probably would have used that approach, but I'm gonna focus on Zope for the moment. And of the other two, I chose to use ZClasses simply because I felt a non-Python person would have a better chance of fixing the site in the future. Still, I've added some Python routines when my novice DTML skills drag a 1 minute function into taking 30. So I've gotten my Publication class written and it works - but minus a few features. 1. The main problem is that I haven't been able to get ZCatalog to search my author list (a line property) correctly. I can search on any other property accept this one. My feeling is that it is treating the entire list as a single property instead of breaking the list items out as individual authors. Does anyone have any insight into this? For the moment, I have a python function that searches the author list. Simple, but I need to figure out how to do it in ZCatalog. 2. Also, I haven't figured out how to make a selection property using ZClasses. I read a post about adding a selection_list (or something like that) property to the propertysheet. This worked, but the selection_list property was also visible on my objects property sheets - not too pretty. I wanted to have multiple selection list also, but this seemed impossible. For the moment, I've hard coded the list in DTML. Any better way? thanks for everyone's help, eric <02bc01beda6e$262f3bc0$8342109-@duke.edu> wrote: original article:http://www.egroups.com/group/zope/?start=8850
Hello,
Forgive me if this is a double post - I sent it to zope@egroups.com , and it never appeared in the posts as far as I could tell.
I'm pretty comfortable with Python, but new to Zope. We're trying to figure out the best way to set up an academic web site that has a list of publications on it. Each publication has several authors, a description, etc. It will also have a pdf and perhaps a postcript copy of the article. We need to be able to search the author list. I'd like to create a PubClass that, when it displays itself looks like:
"Some silly paper" IEEE Trans. on Antennas and Propagation Description: Some rubbish about how great the silly paper is. Authors: Eric Jones, Larry Carin, William Joines PDF: link_to_pdf_file_object (size) PS: link_to_ps_file_object (size)
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:
[ (first_name,last_name), (first_name,last_name),...]
to facilitate searching for a particular author (so that only Larry Carin's papers are displayed on his page). Is there a way to do this sort of thing with ZClasses? Also, I want the Add form to have places to browse for the pdf and ps files - much like a Zope File object - and then add these files to the PubClass object.
Is this best done by creating a class in python or with the ZClass interface?
thanks, eric
_______________________________________________ Zope maillist - Zope@zope.org http://www.zope.org/mailman/listinfo/zope
(To receive general Zope announcements, see: http://www.zope.org/mailman/listinfo/zope-announce
For developer-specific issues, zope-dev@zope.org - http://www.zope.org/mailman/listinfo/zope-dev )
participants (3)
-
Anthony Pfrunder -
ej@ee.duke.edu -
eric jones