[Zope-CMF] Re: Extending a Plone Object - Next problem

David Rawle david@rawle.org.uk
Fri, 21 Feb 2003 18:28:59 -0000


Hi Sim,

I tried that, but there was no difference...seems like the really useful
stuff is really difficult to do. Coming from the pure OO of Java, I expected
extending objects to be really straightforward. I have spent 10 hours trying
to add one field to an existing object definition.

Are there any logs anywhere in Zope/Plone/CMF? I have hunted for *.log but
cannot find anything except Z2.log which has no errors in it. To get some
idea of what the error may be would probably be useful.

- David

---
David Rawle
Checked for Viruses with Norton AntiVirus
Secure Crytographic Signature (S/MIME) may be attached

----- Original Message -----
From: "Sim Harbert" <sim@noisygecko.com>
To: "David Rawle" <david@rawle.org.uk>
Cc: "Florent Guillaume" <fg@nuxeo.com>; <zope-cmf@zope.org>
Sent: Friday, February 21, 2003 5:53 PM
Subject: [Zope-CMF] Re: Extending a Plone Object - Next problem


> This is exactly why I don't want to extend the event type it with the
> "scriptable type" method.  It isn't adding the fields that is hard, but
> creating all the editing and viewing templates.
>
> For what you want to do:
>
> Once you rename the "event_edit_form", then you need to change what
> happens when that form is submitted, both on success and failure.
>
> I am looking up where all that stuff is... Those are strangely not
> associated with the form itself, but are in
> "portal_properties/navigation_properties".  You need to look at
> "default.event_edit*" properties.  I added the ones for my new form to
> get things for myself last week, and can't remember exactly which ones
> it was.  I think it is "default.myevent_edit_form.success" (and failure).
>
> Hope that helps.  I am meanwhile going to go the route of creating my
> one filesystem product.  It may take a while...
>
> -Sim
>
> David Rawle wrote:
>
> >Hi,
> >
> >I am now having problems creating the extended event...
> >
> >I created a new portal_type called myEvent based on CMF Calendar Event as
> >advised by Florent.
> >
> >I have created a newMyEvent as
> >
> ># create the base object
> >container.invokeFactory('Event', id)
> >ob = getattr(container, id)
> ># now add the properties you need
> >ob.manage_addProperty('summary', '', 'text')
> ># finally return the object
> >return ob
> >
> >I changed the two myevent actions and the constrcutor path to newMyEvent.
I
> >have customised myevent_edit (from plone_3rdparty), myevent_view and
> >myevent_edit_form.
> >
> >When adding a new myEvent and clicking Save, I get no errors, but I get
no
> >data anywhere, just an empty myEvent. It just throws it away somewhere.
> >
> >What could be missing? Any ideas?
> >
> >The form action in myevent_edit_form is myevent_edit
> >
> >Thanks,
> >
> >- David
> >
> >---
> >David Rawle
> >Checked for Viruses with Norton AntiVirus
> >Secure Crytographic Signature (S/MIME) may be attached
> >
> >----- Original Message -----
> >From: "Sim Harbert" <sim@noisygecko.com>
> >To: "David Rawle" <david@rawle.org.uk>
> >Cc: "Florent Guillaume" <fg@nuxeo.com>; <zope-cmf@zope.org>
> >Sent: Friday, February 21, 2003 4:40 PM
> >Subject: Re: [Zope-CMF] Extending a Plone Object
> >
> >
> >
> >
> >>This is the same thing I have been wanting to do, and I guess the
> >>"scriptable type" method would work pretty well.  But...
> >>
> >>What I am finding out is that the hard part is getting all of the
> >>editing and viewing "skins" set up.  And when I mean hard, I just mean
> >>that it is not all in one nice easy to install filesystem product.  I am
> >>developing on one or more Zope installations and would like to easily
> >>move it to a production site.  I don't want to have to make all the
> >>customizations through the ZMI for each site.  (And I do know about
> >>using ZEO clients and scripting it all, but I don't have ZEO setup, and
> >>would have to write a lot of scripts to do that.)
> >>
> >>I tried just hacking the CMFCalendar Event type directly to have custom
> >>data fields.  But when Plone is being used, the skin edit forms aren't
> >>the same ones that come with CMFCalendar, so that pretty much defeats my
> >>original goals.  It took me a while just to figure out which
> >>"event_edit" was being used.
> >>
> >>So I guess in the end creating my one Plone filesystem product which
> >>extends sub-classes the Event type might be easiest. I guess I will try
> >>that.  I have installed an PloneMinimalProduct, and will just try
> >>starting with that.
> >>
> >>The good part is that I am quickly becoming a Plone expert.  The bad
> >>part is that what I thought wouldn't be too hard to do has taken a lot
> >>of my time.
> >>
> >>I guess this is a Plone problem, mostly, but it does involve CMF. :-)
> >>But, if I come up with something that I release, I will try my darnedest
> >>to make it work with non-Plone sites too.
> >>
> >>-Sim
> >>
> >>David Rawle wrote:
> >>
> >>
> >>
> >>>That worked beautifully...thank you so much. I have a new portal type
> >>>
> >>>
> >based
> >
> >
> >>>on Event...easy when you know how, huh?
> >>>
> >>>Cheers,
> >>>
> >>>- David
> >>>
> >>>---
> >>>David Rawle
> >>>Checked for Viruses with Norton AntiVirus
> >>>Secure Crytographic Signature (S/MIME) may be attached
> >>>
> >>>----- Original Message -----
> >>>From: "Florent Guillaume" <fg@nuxeo.com>
> >>>Newsgroups: local.lists.zope.zope-cmf
> >>>To: <zope-cmf@zope.org>
> >>>Sent: Friday, February 21, 2003 3:18 PM
> >>>Subject: Re: [Zope-CMF] Extending a Plone Object
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>
> >>>>Raphael Ritz  <r.ritz@biologie.hu-berlin.de> wrote:
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>>>I would like to create a new content type by adding a new field
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>(summary) to
> >>>
> >>>
> >>>
> >>>
> >>>>>>the standard Event object. And then create new forms based on the
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>standard
> >>>
> >>>
> >>>
> >>>
> >>>>>>event forms with the new field on it.
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>>
> >>>>>Unfortunately you can't extend existing content types by simply
adding
> >>>>>
> >>>>>
> >a
> >
> >
> >>>>>few more
> >>>>>properties (I wish there were an easy way for this).
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>There is a very easy way to do this built into CMF, the Scriptable
Type
> >>>>Information.
> >>>>
> >>>>In the Types Tool, create a new Scriptable Type Information, deriving
it
> >>>>
> >>>>
> >>>>from the base type you need. Name it "MyType" for instance. As
> >>>
> >>>
> >>>>"Constructor path", type the name of a Python Script, for instance
> >>>>MyType_create. Create this Python Script in the Types Tool:
> >>>>
> >>>>##parameters=container, id, *args, **kw
> >>>># create the base object
> >>>>container.invokeFactory('Some Base Portal Type', id)
> >>>>ob = getattr(container, id)
> >>>># now add the properties you need
> >>>>ob.manage_addProperty('foo', 1, 'int')
> >>>># finally return the object
> >>>>return ob
> >>>>
> >>>>The only thing you have to be aware of is that during script
execution,
> >>>>the portal_type of your object will be the base portal type and not
yet
> >>>>the one of your final type.
> >>>>
> >>>>Florent
> >>>>--
> >>>>Florent Guillaume, Nuxeo (Paris, France)
> >>>>+33 1 40 33 79 87  http://nuxeo.com  mailto:fg@nuxeo.com
> >>>>
> >>>>_______________________________________________
> >>>>Zope-CMF maillist  -  Zope-CMF@zope.org
> >>>>http://mail.zope.org/mailman/listinfo/zope-cmf
> >>>>
> >>>>See http://collector.zope.org/CMF for bug reports and feature requests
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>>
> >>>
> >>>_______________________________________________
> >>>Zope-CMF maillist  -  Zope-CMF@zope.org
> >>>http://mail.zope.org/mailman/listinfo/zope-cmf
> >>>
> >>>See http://collector.zope.org/CMF for bug reports and feature requests
> >>>
> >>>
> >>>
> >>>
> >>_______________________________________________
> >>Zope-CMF maillist  -  Zope-CMF@zope.org
> >>http://mail.zope.org/mailman/listinfo/zope-cmf
> >>
> >>See http://collector.zope.org/CMF for bug reports and feature requests
> >>
> >>
> >>
> >>
> >
> >
> >
>
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://mail.zope.org/mailman/listinfo/zope-cmf
>
> See http://collector.zope.org/CMF for bug reports and feature requests
>
>