[Zope] Help on Access Rule!!!!
Sidnei da Silva
sidnei@x3ng.com.br
Tue, 16 Oct 2001 20:58:28 -0200
Yes!
Looking at the Localizer Product, by Dieter Maurer, i realized how to do
this, cause its basically the same thing, but im using a template in place of
a language.
here is my code:
----------------------------------------------------------------
request = context.REQUEST
stack = request['TraversalRequestNameStack']
if not request.path:
return
if not hasattr(context, 'template_principal'):
return
obj = getattr(context, request.path[-1], None)
if obj is None:
template = context.template_principal
else:
template = obj.getTemplate(request)
if (template != context.template_principal) and (not template in stack):
request['TraversalRequestNameStack'].append(template)
if (len(stack)>1) and (not context.template_principal in stack):
request['TraversalRequestNameStack'].append(context.template_principal)
return
-----------------------------------------------------------------
Now i need a way of skipping this accessrule when i access the folder it is
defined, cause it is giving me an unauthorized if i try to access it.
Em Tuesday 16 October 2001 20:50, Tom Cameron escreveu:
> lets say you have a setup like this:
>
> /root
>
> |-template_1 <-dtml-method
> |-template_2 <-dtml-method
> |-/folder
>
> if you call
> www.site.com/folder/template_1 you will get template_1 executed as if it
> were a method of the folder. Likewise with template_2
>
> So why not do something like this....
>
> Construct you folderish product with a property called say 'template'.
> Then in the index_html method of the folderish product look for the
> template then use a redirect to that URL
>
> index_html (of the folder)
> -----------
> <dtml-if property_type>
> <dtml-call "RESPONSE.redirect(URL+'/'+template)">
> <dtml-else>
> something just in case property_type not set
> </dtml-if>
>
> i.e. www.site.com/folder/template
>
> Tom
>
>
> => -----Original Message-----
> => From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> => Sidnei da Silva
> => Sent: Wednesday, 17 October 2001 8:30 AM
> => To: Tom Cameron; zope@zope.org
> => Subject: Re: [Zope] Help on Access Rule!!!!
> =>
> =>
> => Sure it will be easier, and thats what im trying to do. Im
> => trying to develop
> => something like a content management system where there's various
> => templates
> => for the user to choose from, all of them on the root folder, and
> => when the
> => user sets one property of the folder to the name of the choosen
> => template, i
> => wish to redirect calls to
> => www.site.com/folder
> => to
> => www.site.com/template/folder
> =>
> => Got it now?
> =>
> => Hope you can help me.
> =>
> => Cheers...
> =>
> => Em Tuesday 16 October 2001 20:25, you wrote:
> => > I cant help thinking that there is a better way to do this.
> => >
> => > What if you tried to call
> => >
> => >
> http://www.server.com/folder_with_property/template_property_of_folder/ =>
> >
> => > Surely this would be easier and work without the need for access rule?
> => >
> => > I am not really certain what you are trying to achieve, but I
> => have never
> => > seen a situation where access rule is needed for this type of
> => > functionality. Normally the built in 'acquisition' of zope is
> => all you need.
> => >
> => > Tom
> => >
> => > => -----Original Message-----
> => > => From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of
> => > => Sidnei da Silva
> => > => Sent: Wednesday, 17 October 2001 8:09 AM
> => > => To: zope@zope.org
> => > => Subject: [Zope] Help on Access Rule!!!!
> => > =>
> => > =>
> => > => I need help on writing an access rule for my site.
> => > =>
> => > => I want it to modify the path based on a property of subobjects.
> => > =>
> => > => My setup has a custom folderish object wich has a property that
> => > => contains the
> => > => template which it uses, and depending on this property i
> => want to call
> => > =>
> => > =>
> => http://www.server.com/template_property_of_folder/folder_with_property
> => > =>
> => > => Got it?
> => > =>
> => > => Ive posted this question a couple times under different subjects
> => > => and no one
> => > => has answered my question till now. ;^(
> => > =>
> => > => --
> => > => Sidnei da Silva
> => > => X3ng Consultoria e Desenvolvimento Ltda.
> => > => sidnei@x3ng.com.br
> => > =>
> => > => _______________________________________________
> => > => Zope maillist - Zope@zope.org
> => > => http://lists.zope.org/mailman/listinfo/zope
> => > => ** No cross posts or HTML encoding! **
> => > => (Related lists -
> => > => http://lists.zope.org/mailman/listinfo/zope-announce
> => > => http://lists.zope.org/mailman/listinfo/zope-dev )
> => > =>
> =>
> => --
> => Sidnei da Silva
> => X3ng Consultoria e Desenvolvimento Ltda.
> => sidnei@x3ng.com.br
> =>
> => _______________________________________________
> => Zope maillist - Zope@zope.org
> => http://lists.zope.org/mailman/listinfo/zope
> => ** No cross posts or HTML encoding! **
> => (Related lists -
> => http://lists.zope.org/mailman/listinfo/zope-announce
> => http://lists.zope.org/mailman/listinfo/zope-dev )
> =>
--
Sidnei da Silva
X3ng Consultoria e Desenvolvimento Ltda.
sidnei@x3ng.com.br