External Methods and RESPONSE
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: ((<Folder instance at 8cf698>, '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: <string>) 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 <string>, 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
Tony McDonald wrote:
However, I am creating my output page from an External Method, which looks something like this...
def sg_preamble(self, guideid):
try def sg_preamble(self, guideid, RESPONSE=None): or maybe you can access it with self.RESPONSE. -- Itamar S.T. itamars@ibm.net
At 2:46 pm +0200 3/12/99, Itamar Shtull-Trauring wrote:
Tony McDonald wrote:
However, I am creating my output page from an External Method, which looks something like this...
def sg_preamble(self, guideid):
try def sg_preamble(self, guideid, RESPONSE=None):
That's it.... :) Along with html = template(self, RESPONSE=RESPONSE) Everything is working fine. Thanks Itamar! (and Pavlos too!). 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
participants (3)
-
Itamar Shtull-Trauring -
Pavlos Christoforou -
Tony McDonald