[Zope3-Users] Customisation of addform

Roger Ineichen dev at projekt01.ch
Tue Nov 30 04:41:55 EST 2004


Hi Florian

> -----Original Message-----
> From: Florian Lindner [mailto:mailinglists at xgm.de] 
> Sent: Tuesday, November 30, 2004 8:03 AM
> To: dev at projekt01.ch; zope3-users at zope.org
> Subject: Re: [Zope3-Users] Customisation of addform
> 
> Roger Ineichen schrieb:
> > Hi Florian
> > 
> > 
> >>-----Original Message-----
> >>From: Florian Lindner [mailto:mailinglists at xgm.de] 
> >>Sent: Monday, November 29, 2004 10:05 AM
> >>To: dev at projekt01.ch
> >>Cc: zope3-users at zope.org
> >>Subject: Re: [Zope3-Users] Customisation of addform
> >>
> >>Roger Ineichen schrieb:
> >>
> >>
> >>>>Is there a piece of code to see how the addform is being 
> >>>>generated? So I can see which macros and skin it uses.
> >>
> >>No, I think you missunderstood me.
> >>The addform directive is creating the addform by using 
> several macros 
> >>and fill the slots in the macros. How do I know which macros 
> >>and slots 
> >>it is attempting to use?
> >>
> >>
> >>>See zope.app.rotterdam.standardmacros.py
> >>
> >>macro_pages = ('skin_macros', 'view_macros', 'dialog_macros', 
> >>navigation_macros')
> >>
> >>How does Zope knows which of these macro_pages to pick?
> > 
> > 
> > Lookup in every macro page. Then a macro is registred as
> > a view an theres no way to have to macros with the same name.
> > So the Macros class can try till it's finds the macro in the 
> > mapping like:
> > 
> > class Macros(object):
> >     implements(IItemMapping)
> > 
> >     macro_pages = ()    
> >     aliases = {
> >         'view': 'page',
> >         'dialog': 'page',
> >         'addingdialog': 'page'
> >         }
> > 
> >     def __getitem__(self, key):
> >         key = self.aliases.get(key, key)
> >         context = self.context
> >         request = self.request
> >         for name in self.macro_pages:
> >             page = getView(context, name, request)
> >             try:
> >                 v = page[key]
> >             except KeyError:
> >                 pass
> >             else:
> >                 return v
> >         raise KeyError, key
> > 
> > See in zope.app.basicskin.standardmacros.py
> 
> Ok, that's clear now.
> 
> Whats still really puzzling me is this question:
> 
> The addform directive is creating the addform by using several macros
> and fill the slots in the macros. How do I know which macros
> and slots it is attempting to use?
> For example: I want to create a customize a containerView. 
> How do I know 
> which macros it uses and which slots it fills?

That's nearly impossible. Zope3 uses the contents.pt in containerViews
for the contents.html view from the zope.app.container.browser folder.

Belive me, theres no way to register another template for this directive.
That's really hardcoded. Nobody fixed it till now. My ideea to let 
us override metaconfigure registrations, wasn't accepted. This makes it 
impossible to change templates which are declared as ViewPageTemplates
in classes if such a class is used as a metadirective and registers Zope3
stuff by the start process.

What you can do is, copy another template.pt to the
zope.app.container.browers.

Like a patch. ;-(

The addform template comes from zope/app/form/browser/add.pt.

Regards 
Roger

> Thanks,
> Florian
> 
> 



More information about the Zope3-users mailing list