[ZPT] myTemplatePage/blah not returning 404 error

Clemens Robbenhaar robbenhaar at espresto.com
Mon Nov 24 06:59:10 EST 2003


Hi kmkl,

 > I have a page template 'myTemplatePage'. When I look up this URL:
 > "http://.../myTemplatePage/blah" (where blah is non-existant) I still get
 > myTemplatePage being shown, rather than the standard error message with a
 > 404 error.
 >  
 > This seems to be happening with any page template I try it on regardless of
 > if its in the root or subfolder.
 >  

 Yes, this is the default behaviour of page templates. It is the same
as for Scripts (Python): if the Publisher finds a page template in the
path, it immediately stops processing, publishes the page template and
leaves the rest of the path in the variable "traverse_subpath" of the
request.

 You could try to add something like 

 <tal:dummy 
     define="object python:here.restrictedTraverse(request['traverse_subpath')" />


to get at least some error message, if the rest of the path is not
empty, and points to a non existing object. (If any acquisition gurus
are reading this thread, they maybe could advice, if
"template.restrictedTraverse" is better suited or not.)

 I feel the "request_path" feature is not really overdocumented yet,
to say so ;). Actually I figured it out from the analogous
"traverse_subpath" variable implicitely defined in python scripts + guessing.

hope this helps,
clemens



More information about the ZPT mailing list