[Zope-dev] preventing acquisition

Robin Becker robin@jessikat.demon.co.uk
Tue, 3 Aug 1999 12:26:48 +0100


In article <BWrBiGA+QCp3EwMI@jessikat.demon.co.uk>, Robin Becker
<robin@jessikat.demon.co.uk> writes
>In article <37A412DF.19C384F7@digicool.com>, Michel Pelletier
><michel@digicool.com> writes
>>Robin Becker wrote:
>>> 
>>> I have found acquisition useful in several cases, but I would like to
>>> eliminate it for certain folders
>>> 
>>> I have
>>> 
>>> /-index_html
>>>  |
>>>  |--DOCS/
>>>  |
>>>  |--IMAGES/
>>>  |
>>>  |--RUBBISH/
>>> 
>>> it's useful in DOCS/mydoc_html to refer to IMAGES/myimage.gif, but I
>>> really don't want RUBBISH/index_html to be available as /DOCS/RUBBISH
>>> 
>>> Do I have to go through a whole rigmarole of defining roles/users or is
>>> there some easy way to make RUBBISH non-acquirable?
>>> --
>>
>>The index_html method in R could check the roles of the user, and raise
>>NotFound if you weren't happy about user seeing RUBBISH/.   Any
>>combination of DTML check could be made before you did a <dtml-raise
>>NotFound><dtml-zippy></dtml-raise>.   The Zippy tag filling in for an
>>inciteful error message in this case.
>>
>this is nice, but it doesn't really answer the question. If I said that
>I want /Status/index_html to be valid, but not /DOCS/Status/index_html
>this isn't a function of the user at all, but of the absolute URL so I
>guess I want to ensure that the document id corresponds to the absolute
>URL.
>
>But even though I can check and act on this it isn't the same as making
>the /Status folder to be non acquirable.
...
my version of michels code looks like
<dtml-var standard_html_header>
<dtml-if "PARENTS[0].id not in PARENTS[1].objectIds()">
     <dtml-raise NotFound>
          <h2>You're not supposed to be looking at 
          <dtml-var "absolute_url()"> </h2>
     </dtml-raise>
</dtml-if>
<h1>Status</h1>
<dtml-var get_status>
<dtml-var standard_html_footer>

now assuming /Status/index_html is the database path host/Status works,
but host/DOCS/Status fails
-- 
Robin Becker