[Zope] External Methods and RESPONSE

Tony McDonald tony.mcdonald@ncl.ac.uk
Fri, 3 Dec 1999 11:53:04 +0000


HI all,
I've got a weird one here,
I'm using Martijns' method of allowing people into a site based on 
domain (basically no password, and allowed domains -> AllowedUser and 
another acl_users folder on level higher with AnonUser = no password 
and domain = *.*.*.*).

My standard_html_header looks like this;
<dtml-if "_.str(REQUEST['AUTHENTICATED_USER'])=='AnonUser'">
<dtml-call "RESPONSE.redirect('denied')">
</dtml-if>
<html>
....

This works fine and dandy if someone goes to a page directly.

However, I am creating my output page from an External Method, which 
looks something like this...

def sg_preamble(self, guideid):
""" render the front page of a guide based on guideid """
....
     template_str = self.standard_html_header.read_raw()
     template = DocumentTemplate.HTML(template_str)
     html = template(self)
...
     template_str = self.standard_html_footer.read_raw()
     template = DocumentTemplate.HTML(template_str)

     return html + template(self)

Trouble is that I'm getting NameErrors saying that RESPONSE doesn't exist..

<!--
  Error type:  NameError
  Error value: RESPONSE
  -->

<!--
Traceback (innermost last):
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/ZPublisher/Publish. 
py, line 214, in publish_module
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/ZPublisher/Publish. 
py, line 179, in publish
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/Zope/__init__.py, 
line 201, in zpublisher_exception_hook
     (Object: ElementWithAttributes)
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/ZPublisher/Publish. 
py, line 165, in publish
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/ZPublisher/mapply.p 
y, line 160, in mapply
     (Object: sg_frontpage)
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/ZPublisher/Publish. 
py, line 102, in call_object
     (Object: sg_frontpage)
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/Products/ExternalMe 
thod/ExternalMethod.py, line 246, in __call__
     (Object: sg_frontpage)
     (Info: ((&lt;Folder instance at 8cf698&gt;, 'project'), {}, None))
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/Extensions/get_all_children.py 
, line 239, in sg_preamble
     (Object: ElementWithAttributes)
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/DocumentTemplate/DT 
_String.py, line 502, in __call__
     (Object: &lt;string&gt;)
   File 
/home/nnle/Zope-2.0.0-solaris-2.6-sparc/lib/python/DocumentTemplate/DT 
_Util.py, line 321, in eval
     (Object: RESPONSE.redirect('denied'))
   File &lt;string&gt;, line 0, in ?
NameError: (see above)

-->

Does anyone have any ideas?
cheers
tone.
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project 
http://nle.ncl.ac.uk/
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2