[Zope3-Users] Customisation of addform
Roger Ineichen
dev at projekt01.ch
Mon Nov 29 17:21:36 EST 2004
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
Regards
Roger Ineichen
Projekt01 GmbH
www.projekt01.ch
_____________________________
END OF MESSAGE
> Thanks,
>
> Florian
>
More information about the Zope3-users
mailing list