[Zope] Extending Standard Objects
Michel Pelletier
michel@digicool.com
Tue, 18 Jan 2000 16:53:23 -0500
> -----Original Message-----
> From: James W. Howe [mailto:jwh@allencreek.com]
> Sent: Tuesday, January 18, 2000 4:20 PM
> To: zope@zope.org
> Subject: [Zope] Extending Standard Objects
>
>
> In my experimentations with Zope, I'm trying to extend the
> Image object to
> include caption information and formatting. I've created a
> ZClass which
> has Image as one of the base classes. I'm a little confused
> as to what to
> do next. For example, what properties do I need to defined.
> Do I just
> define the caption property?
Yep.
> Do I inherit any properties from Image
> itself?
You inherit all attributes of the base class, including properties and
methods.
> I also noticed that because I subclassed from Image,
> certain views
> are created for me by default. The "Edit" view is defined to use
> manage_main. The "Upload" view uses manage_uploadForm.
Yep.
> If
> I want to
> enhance the functionality of the Edit and Upload view, do I
> just need to
> create new methods on my ZClass and point the view at the new
> method?
Or you can override the existing methods.
> If I
> wanted my views to look just like the normal views (manage_main and
> manage_uploadForm) with only minor tweaking, where would I
> find the source
> to those methods?
They are on the filesystem, for Image object probably in lib/python/OFS.
I wouldn't change the documents on file, but rather copy them into new
methods of your new class and override the behavior you wish to 'tweak'.
-Michel