OK, I'm sorry for the wierd title, but I can't really describe what I want to say very easily in one line.
 
Basically, my problem is this;
 
- I have a zclass called DEHS with catalog_aware and dtml_document as base classes.
- DEHS instances have a selectable property of public/private.
- I want to be able to make it so that if the property is set to 'private', then only people on a particular network may access it. So, here is what I have done (and it works),
 
<dtml-call "REQUEST.set('available', 0)">
<dtml-if "propertyLabel(availability) == 'private'">
<dtml-call "REQUEST.set('available', 1)">
</dtml-if>
 
<dtml-call "REQUEST.set('dom', _.string.split(REQUEST.REMOTE_ADDR, '.'))">
<dtml-if "dom[0] == '192'">
<dtml-if "dom[1] == '168'">
<dtml-call "REQUEST.set('available', 0)">
</dtml-if>
</dtml-if>
 
<dtml-if "available == 1">
<dtml-in PARENTS>
<dtml-let PARENT="_.getitem('sequence-item')">
<dtml-if "PARENT.hasProperty('dehs_site_root_folder')"><dtml-call "REQUEST.set('restricted', PARENT.absolute_url())"></dtml-if>
</dtml-let>
</dtml-in>
<dtml-call "RESPONSE.redirect(restricted+'/restricted.html')">
<dtml-else>
 
<dtml-var standard_html_header>
 
 
 
<dtml-var standard_html_footer>
</dtml-if>
 
So, what's the problem I hear you ask.  Well, I don't really want all this code to be visible (or breakable) in every DEHS instance. What I would really like to do is have this,
 
<dtml-var privacy>
 
<dtml-var standard_html_header>
 
<dtml-var standard_html_footer>
 
</dtml-if>
 
where, <dtml-var privacy> is just all of the code that I have above s_h_h. However, zope will not let me do this because I end up with a <dtml-if> that is missing its closing tag, and one that does not have an opening tag. I realise that I there are products already designed with the sort of functionality I am after built in, but I will not have much influence on the products that will be available on the server that this site will end up on... which is why I'm doing it in this way.
 
Any input is much appreciated.
 
cheers
 
tim

Reply via email to