[Zope] ZClass subclassing a File

Brian Lloyd Brian@digicool.com
Tue, 27 Jul 1999 09:28:26 -0400


> OK, I have yet another one (thanks for all the answers so far...)
> 
> I have a ZClass that has some properties, etc. I want it to 
> be a subclass of 
> other ZClasses that I have defined, and the "File" type 
> provided by Zope.
> 
> What I want is a "File" that Zope recognizes, so that I can 
> load a file in, 
> etc., but have the various properties/methods available 
> also... can this be 
> done?
> 
> If I define my ZClass (say MSFile) as a subclass of 
> MSFileHolder (which 
> provides some generic file/image handling that I want to do), 
> and a subclass 
> of File, then it works as a File (I can never seem to see the 
> Properties 
> pages, etc. that I set... if I open the instantiation of the 
> object in the 
> management interface, I just see it as a "File"... its as if 
> the other stuff 
> doesn't exist.
> 
> Am I way off base here?

No - you just need to create "views" for the property sheets
that you want to be able to manipulate for your MSFile instances.

A quick example: go to your MSFile ZClass and click on "Property
Sheets", and create a property sheet called "ExtraProperties" with
a few defined properties.
Next, click on the "Views" tab of your MSFile class and add a new
"view" that points to that property sheet (type "Extra" in the New
text box, and select "propertysheets/ExtraProperties/manage" from
the select list and click the "Add" button.

Now your MSFile instances should have an "Extra" tab in their mgmt
interface, which will take you to the form for managing the extra
properties on that instance.

Hope this helps!


Brian Lloyd        brian@digicool.com
Software Engineer  540.371.6909              
Digital Creations  http://www.digicool.com