ZClasses and properties
You need to subclass Object Manager when you generate the ZClass. Than you can add other objects into the instances. If you only want to add photos, build another ZClass in your class, which represents exactly a photo object (subclass from file or image) with all the needed properties filled during upload. HTH __Janko Oscar Picasso writes:
Hi,
I think there is something I don't understsand about ZClasses or maybe the permissions used in ZClasses.
I created a Zclass in which I have a propertie sheet with title, description... But what I want is to be able to store in each instance of that class some objects (photos). So I created in the Class/propertysheets/methods a folder called 'Photo'.
This doesn't work because it seems that all what is put in the propertysheets/methods are Class "methods" so when I add something there, all the instances are updated with the new object.
Do I have to do this programatically or is there a means to use the management screen.
Any help greatly appreciated.
****************************************************** Oscar Picasso picasso@videotron.ca
... feel free to write to me also in french or spanish (english is not my native language ;) ******************************************************
Thanks for your help. It works fine using the first solution. I tried the second that seemed to better fit my needs. But I'm unable to add a new photo in an instance. Here is what I've done: Product at /Control_Panel/Products/MZProduct MZClass #my main class MZClass_add (MZClass constructor) MZClass_addForm (MZClass constructor input form) MZClass_add_permission (MZClass constructor permission) MZClass_factory (MZClass factory) MZPhoto_add_permission (MZPhoto constructor permission) Z Class at /Control_Panel/Products/MZProduct/MZClass #in the view tab Contents manage_main Properties propertysheets/mz_info/manage Add Photo MZPhoto_addForm Z Class at /Control_Panel/Products/MZProduct/MZClass #in the methods tab MZPhoto MZPhoto_add (MZPhoto constructor) MZPhoto_addForm (MZPhoto constructor input form) MZPhoto_factory (MZPhoto factory) When I view an instance I see the three tabs: Contents, Properties, Add Photo. If I go to Add Photo tab and enter and id. I get the following message: Error Type: TypeError Error Value: argument title was ommitted What's wrong with my classes?
You need to subclass Object Manager when you generate the ZClass. Than you can add other objects into the instances. If you only want to add photos, build another ZClass in your class, which represents exactly a photo object (subclass from file or image) with all the needed properties filled during upload.
HTH __Janko
Oscar Picasso writes:
Hi,
I think there is something I don't understsand about ZClasses or maybe the permissions used in ZClasses.
I created a Zclass in which I have a propertie sheet with title, description... But what I want is to be able to store in each instance of that class some objects (photos). So I created in the Class/propertysheets/methods a folder called 'Photo'.
This doesn't work because it seems that all what is put in the propertysheets/methods are Class "methods" so when I add something there, all the instances are updated with the new object.
Do I have to do this programatically or is there a means to use the management screen.
Any help greatly appreciated.
****************************************************** Oscar Picasso picasso@videotron.ca ******************************************************
Ha, the type error comes from the file methods. Actually what happens is, that the interface MZPhoto_addForm and MZPhoto_add only want to get the id. But a File and an Image class needs to get a title and also an uploaded file. Look for the addForm when you add a File somewhere in Zope. So you need to extent MZPhoto_addForm with a title and file form field. As this is all put into the REQUEST object the MZPhoto_add need not to be changed. (Have not tried it). I can not say if this is supposed to work right, that the automatically generated forms should be complete for the object which should be added. HTH __Janko
Thanks a lot. It worked. I had to change the form, adding fields to get the title and file. I also needed to change change the default form tag adding: ENCTYPE="multipart/form-data" method="post"
Ha, the type error comes from the file methods. Actually what happens is, that the interface MZPhoto_addForm and MZPhoto_add only want to get the id. But a File and an Image class needs to get a title and also an uploaded file. Look for the addForm when you add a File somewhere in Zope.
So you need to extent MZPhoto_addForm with a title and file form field. As this is all put into the REQUEST object the MZPhoto_add need not to be changed. (Have not tried it).
I can not say if this is supposed to work right, that the automatically generated forms should be complete for the object which should be added.
HTH
__Janko
****************************************************** Oscar Picasso picasso@videotron.ca ******************************************************
Hi all, I am building an object hierarchy like the following (most objects inherit from Object Manager and Folder and the noncontainerclasses also from ZCatalog). Data--+--CompanyContainer--Company--+--Division | |--Product | `--Got Hardware | `--PersonContainer--Person--+--Contact `--Job .... The CompanyContainer is for collecting Companies in a folderish object. Each Company can contain Divisions or single Persons. And last but not least you have Persons collected in a Personcontainer, in a company or in a division of a company.. Problem: I want "Person" to show up in the subobjects of Company and Division. How does one do that? Everything I tried did no work (I guess, I missed some of the permission stuff as usual ;-)) Another Question: For most of my objects I need Containerclasses to deal with them (show all, show an alphabetic selection, show top priority selection,..), but this gets quite tedious after a while. Is there a better way handling this? has *_factory something to do with it? If yes, how does one set up containers? as usual a lot of questions... -- Tom
participants (3)
-
Janko Hauser -
Oscar Picasso -
Tom Schwaller