[Zope] Re: [Zope-dev] Simple question about namespaces

Sidnei da Silva sidnei@x3ng.com.br
Mon, 24 Sep 2001 11:24:21 -0300


Ive read about this Localizer, and it seems pretty like what i want to do, 
but i couldnt figure if it will work when i have folders inside my templates 
folder containing some specialized images. 

My only concern in doing this is not duplicate documents and images across 
templates and continue using folders to organize images inside the templates, 
like the problem described at this page:

http://www.zope.org/Members/Hoekstra/ChangingZopeContexts

I want to have:
SpecialTemplate/images/header1.jpg
SpecialTemplate/images/header2.jpg
NormalTemplate/images/header2.jpg

and when i access:
/SpecialTemplate/NormalTemplate/mydtmlmethod
 
i want it to show header1.jpg of SpecialTemplate and header2.jpg of 
NormalTemplate *without* having to tell mydtmlmethod where are this images.

I have found another product called the Mirrowing Folder, that does something 
like this. But i wish to go a little further:

When i call /mydtmlmethod, i wish that it is called in the context of 
/SpecialTemplate/NormalTemplate withot redirecting url. I was thinking that 
to do this, i needed to modify bobo_traverse, or something like that. Cause 
this is what the Mirrowing Folder does. But now that ive seen your localizer 
i realized that maybe i could use the Mirrowing Folder *and* SiteAccess to do 
what i want to do.

Hope you understand a little better this time (im not so good writing 
english).


Em Saturday 22 September 2001 19:34, Dieter Maurer escreveu:
> ... redirected to "zope@zope.org"....
> Sidnei da Silva writes:
>  > ....
>  > Im having trouble at two points: 
>  > * First, in making the Specialized Template look over at the Main 
Template 
>  > under not found some content (like i said, the specialized content may 
>  > containt one or two images inside a images folder). Ive tried doing this 
by 
>  > overriding the __bobo_traverse__ method of the Specialized Template, but 
it 
>  > not worked.
> I do not understand what you want.
> 
>   If you want the following behaviour:
> 
>     take a specialized template if it exists, otherwise
>     take a standard template, then you have several options:
> 
>       *  use "hasattr" to check for existance:
> 
>            <dtml-let selectedTemplate="_.hasattr(Special,'template') and 
Special.template or Standard.template">
> 	      ....
> 	   </dtml-let>
> 
>       *  use techniques similar to 
> 
>          <http://www.dieter.handshake.de/pyprojects/zope/Localizer.py>
> 
>       *  use acquisition magic:
> 
>            Templates/
> 	     ...standardTemplates...
> 	     SpecializedTemplates/
> 	       ....
> 
> 
>  > * Second, when i call the Content Folder, it is needed to apply the 
template 
>  > to it. The content has a property that says what is the Specialized 
Template 
>  > that has to be applied when calling it, so, when i call:
>  > 
>  > http://www.mysite.com/ContentFolder
>  > 
>  > i need to apply the template to the folder, maybe calling:
>  > 
>  > http://www.mysite.com/MainTemplate/SpecializedTemplate/ContentFolder
> I would be astonished when this would do what you want!
> 
> But, a SiteAccess AccessRule may allow you to realize what you want.
> HowTo's at "zope.org".
> 
> 
> Dieter
> 
> 

-- 
Sidnei da Silva
X3ng Consultoria e Desenvolvimento Ltda.
sidnei@x3ng.com.br