[Zope3-dev] Re: How to call addform of other Module

Philipp von Weitershausen philipp at weitershausen.de
Thu Oct 21 10:01:30 EDT 2004


Florian Lindner wrote:
> Philipp von Weitershausen schrieb:
> 
>> Florian Lindner wrote:
>>
>>> Hello,
>>> how can I call the addform of a object from a another object which is 
>>> defined in another object? The problem I have is that there is no 
>>> instance of the object existing to call...
>>
>>
>>
>> Sorry, I have absolutely no idea what you're talking about. Can you 
>> explain your problem in detail? (If you have problems with the 
>> English, you can email me in German privately)
> 
> 
> Oh, yeah, when I read it now it seems even to me confusing. I think it 
> was just a little late yesterday evening...
> Ok, let's go in details:
> I've a object called Event with a subdir skin which sould contain the 
> actual user interface (without using the ZMI). In 
> Event/skin/configure.zcml I've defined a addform:
> 
> <addform
>  for="..interfaces.IEvent"
>  name="addEvent.htm"
>  permission="zope.Public"
>  schema="..interfaces.IEventFolder"
>  content_factory="..event.Event"
>  layer="centershock"
>  template="addEvent.pt" />
> </configure>
> 
> I've also another folder called Main which is containingthe Main-Object. 
> which a kind of index page:
> 
> <page
>    for="..interfaces.IMain"
>    name="index.htm"
>    permission="zope.Public"
>    layer="centershock"
>    template="main.pt"
> />
> 
> Now I want to link from this index.htm to the addform of Event, like 
> that http://localhost:8080/++skin++centershock/eventinst/@@addEvent.htm. 
> But my problem is that eventinst is not existing yet, so where to link?

Addforms aren't views for the thing they're adding. After all, the 
addform view is supposed to create the object for us in the first place. 
Addforms are views for adding views. Adding views are views for 
containers that are invoked when adding stuff to them.

   some_container/@@+

is usually the adding view for a container.  You can invoke add forms 
with the action.html view for the adding view:

   some_container/@@+/action.html?type_name=NameOfYourAddForm

(If you look closely at the Add menu in the Contents page of containers, 
you will see that all URLs are composed like this...)

Philipp


More information about the Zope3-dev mailing list