[Zope] ZClass issue

John E. Vincent john@lusis.org
Tue, 15 Feb 2000 13:07:01 -0500 (EST)


On Tue, 15 Feb 2000, Kevin Dangoor wrote:

> Hi, John
> 
> ----- Original Message -----
> From: "John E. Vincent" <john@lusis.org>
> To: <zope@zope.org>
> Sent: Monday, February 14, 2000 12:31 AM
> Subject: [Zope] ZClass issue
> 
> 
> > Okay I've been pouring over documentation for the past week and I just for
> > the life of me cannot figure this out. I had originally created a product
> > to do what I needed it to do but found a reference that ZClass might be
> > easier. Basically what I have is a ZClass that will allow a user to create
> > a template for thier site. The class allows them to upload 4 separate
> > images as well as give the site a title. Now what I want to do is be able
> > to call this ZClass via a link to it directly or or a link to a method
> > which itself calls the ZClass.
> 
> Let me make sure I've got this straight... You're creating an ObjectManager
> ZClass that will contain 4 images and a title property. Is that right?

Well sort of. The ZClass performs several steps. It contains a Sample
folder that is manage_clone to replicate the structure of the templates
folder. It also contains a ZSQL method which inserts a record of the
template in a MySQL database. The actual images are in the sample folder
with the names background, topleft, topright and navbar. I could possibly
just have a dtml document that has the form part of my ZClass as the
actual link and have the dtml method the form calls actually point to the
add method of the ZClass but I figured since I already had everything self
contained in that class, why duplicate my work? 


> 
> > I've been reading the "Adding ZClass Instances Programmatically" doc for
> > about 3 hours and I'm about fried from it. There has to be something
> > obvious here. Basically I have a method that contains these 3 lines:
> 
> I'm not completely sure that that HowTo (which I wrote) is what you're
> looking for. For most cases, you can add ZClass instances quite conveniently
> through the normal Zope management screens. The basic ZClass configuration
> with the addForm and the Factory makes this easy. The HowTo covers the case
> where you need to create ZClass instances as part of some larger routine.
Right. I guess the issue is that I want to shield the people who will be
uploading the templates (the other people on the project with NIL amount
of web experience) from the Zope interface although that may not be
exactly what I need to do. Maybe I should just provide them with a
stripped down version of the Zope Management interface. The issue is that
at some point users will need to be able to do the same thing from thier
preferences page and upload thier own template information. I was hoping
to make the code as reusable as possible.

> > > <dtml-with "manage_addProduct['TemplateCreation']">
> >   <dtml-call "templateCreate_addForm">
> > </dtml-with>
> 
> The fact that you're calling addForm may imply that you're not trying to add
> ZClass Instances via a program, but that you want to fill out the addForm
> and then create the instance. Is that right? If so, that's what you get when
> you try to do it via the management interface...
> 
Right. exactly. I want a link to behave just as the managemnt interface
does for that ZClass. To call what ever the factory has listed as the
default page. I initially created this as a normal product but found out(
maybe incorrectly) that ZClasses are the only way to index these sorts of
things via the Zope Search methods. 

The concept of resuable code is fairly new to me. Im an old perl hacker
but for the number of people helping me develop this app, Zope seemed to
just fit right in. In the vein of being reusable, it maked sense to be
able to create the key portions of site management, wether it be account
creation, question entry, or template selection/creation in as few places
as possible and provide different sets of actions that can be applied to
that object. Maybe I'm missing an important concept here?

Thanks for your help. I've noticed that the zope list is a very patient
and supportive family to the new people no matter what environment they
come from. This speaks volumes for Zope.

> Kevin > > >
_______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
> 

-- 
John E. Vincent
http://www.lusis.org - opensource(libre) webhosting
http://www.jyradelix.com - Jyradelix Designs
http://www.lusis-integrations.com - Lusis Network Integration Consultants
---------------
"Some people call me crazy but I prefer to think of myself as a freelance
lunatic" - me