-----Original Message----- From: Martijn Pieters <mj@digicool.com> To: Dmitry B. Khlonin <khl@paloma.spbu.ru> Cc: zope-dev@zope.org <zope-dev@zope.org> Date: 18 марта 2000 г. 9:32 Subject: Re: [Zope-dev] Error 404: Not Found
On Sat, Mar 18, 2000 at 02:34:54AM +0300, Dmitry B. Khlonin wrote:
I have some trouble trying to extend hierarchical structure of my site. If I have "virtual" directory structure, need to call method resolving "Error 404". I've try it. But method "standard_error_message" render only, and no way to catch exception. I don't need to see Zope Error Screen. I want to give up this exception. What you recommend me?
<!--#if "error_type=='NotFound'"--> <!--#var "RESPONSE.redirect('/')"--> <!--#/if-->
Have a look at how it is being handled at Zope.org:
I've look at ^^^ and I found that problem for you too. I've try to found document 'aaa' in root of 'www.zope.org' Looked at 'source code' and found '... Traceback (innermost last): ...'. But for me needed no "traceback" and redirecting for example to root as I've tryed above. Or executing of some "dtml-document" or "dtml-method". If I include <dtml-var error_404> (as in below, all of this in "standard_error_message") <dtml-var standard_html_header> <dtml-if error_message> <dtml-if "error_type != 'NotFound'"> <dtml-var error_message> <dtml-else> <dml-var error_404> </dtml-if> <else> and make a dtml-method - "error_404" in which <dtml-var "RESPONSE.redirect('/')">. Then I take the "myhost.dz/error_404" and give true resulting redirect to root of "myhost.dz". But if I try to "myhost.dz/efjklwekljfwejkl" then I give empty document with symbol "/" and traceback in it . Why? Why not redirected to root? P.S. <dtml-try> and <dtml-except> not in the way.) ---- Attachment aaa.htm --------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd"> <HTML> <HEAD> <TITLE>Welcome to Zope.org</TITLE> <link rel="stylesheet" href="http://www.zope.org/zope_css" type="text/css"> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#000066" VLINK="#606060" TOPMARGIN="0" LEFTMARGIN="0" MARGINWIDTH="0" MARGINHEIGHT="0"> <BASEFONT FACE="Verdana, Arial, Helvetica, sans-serif" SIZE="2"> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0" xWIDTH="100%"> <TR> <TD WIDTH="10" BGCOLOR="#000000" ALIGN=CENTER> </TD> <TD COLSPAN="2" BGCOLOR="#6699CC" VALIGN="TOP" WIDTH="300"><A HREF="/"><IMG SRC="/Images/zopelogo.jpg" ALT="Z Object Publishing Environment" ALIGN="ABSMIDDLE" WIDTH="300" HEIGHT="66" BORDER="0"></A></TD> <TD BGCOLOR="#6699CC" VALIGN="TOP" ALIGN="RIGHT" xWIDTH="99%" CLASS="welcome"> <p class="welcome"> <A CLASS="globalmenu" HREF="/SiteIndex/searchForm">Search</A> | <a CLASS="globalmenu" href="/Products">Download</a> | <a CLASS="globalmenu" href="/Documentation">Documentation</a> | <a CLASS="globalmenu" href="/Resources">Resources</a> | <a CLASS="globalmenu" href="/Members">Members</a> <BR> <FORM ACTION="/SiteIndex/search" METHOD="GET"> Search <INPUT TYPE="hidden" NAME="date:date" value="1969/12/31 16:00:00 US/Pacific"> <INPUT TYPE="hidden" NAME="date_usage" value="range:min"> <INPUT TYPE="text" NAME="text_content" SIZE="15"> <INPUT TYPE="IMAGE" SRC="/Images/go.gif" ALT="Go Button!" ALIGN="ABSMIDDLE" BORDER="0" WIDTH="20" HEIGHT="20"> </FORM> </p> </TD> <TD WIDTH="10" BGCOLOR="#6699CC" ALIGN="RIGHT" VALIGN="BOTTOM"><IMG SRC="/Images/blue-rounder1.gif" WIDTH="14" HEIGHT="20" BORDER="0"></TD> </TR> <TR> <TD WIDTH="10" BGCOLOR="#000000" ALIGN=CENTER> </TD> <TD WIDTH="150" BGCOLOR="#6699CC" VALIGN=TOP> <H2 CLASS="lefttitle"> Guest</H2> <p class="sidemenu"> <A CLASS="sidemenu" HREF="/Register/register.html">Join Zope.org</A> <BR> <A CLASS="sidemenu" HREF="/login.html">Log in</A> </p> <HR NOSHADE SIZE="0.5" WIDTH="95%"> <H2 CLASS="lefttitle"> Zope Exits</H2> <p class="sidemenu"> <A CLASS="sidemenu" HREF="http://weblogs.userland.com/zopeNewbies/">Zope Newbies</A><BR> <A CLASS="sidemenu" HREF="http://www.technocrat.net">Technocrat.net</A><BR> <A CLASS="sidemenu" HREF="http://www.appwatch.com">Appwatch.com</A><BR> <A CLASS="sidemenu" HREF="http://www.codecatalog.com">CodeCatalog.com</A><BR> </p> </TD> <TD COLSPAN="2" VALIGN=TOP> <table cellpadding="10" cellspacing="0" border="0" xwidth="100%"> <tr valign="top"> <td> <H1> Welcome to Zope.org </H1> <h2>Not Found</h2> <p>The resource you requested was not found. You may wish to <a href="/SiteIndex/searchForm">search</a> Zope.org to find what you are looking for. </p> <p> If you were trying to access a resource on the <a href="http://www.zope.org:8080">old Zope.org site</a>, try this <a href="http://www.zope.org:8080/aaa">http://www.zope.org:8080/aaa</a>. </p> </td> </tr> </table> </TD> <TD WIDTH="10" ALIGN=CENTER> </TD> </TR> <TR> <TD WIDTH="10" BGCOLOR="#000000" ALIGN=CENTER> </TD> <TD WIDTH="150" BGCOLOR="#6699CC" ALIGN=RIGHT VALIGN=BOTTOM><IMG SRC="/Images/blue-rounder2.gif" WIDTH="142" HEIGHT="20" BORDER="0" ALT=""></TD> <TD COLSPAN="2" ALIGN=CENTER CLASS="plain"><HR NOSHADE SIZE="0" WIDTH="95%"> <a href="/privacy.html">Privacy policy</a> <A HREF="http://www.zope.org/aaa?pp=1">Printable Page</A> <A HREF="mailto:webmaster@zope.org">Feedback about Zope.org</A> <A HREF="http://www.zope.org/aaa/view_source">DTML Source</A> </TD> <TD WIDTH="10" ALIGN=CENTER> </TD> </TR> <TR> <TD WIDTH="10"> </TD> <TD WIDTH="150"> </TD> <TD WIDTH="150"> </TD> <TD> </TD> <TD WIDTH="10"> </TD> </TR> </TABLE> <P CLASS="copyright">© 1999, <a href="http://www.digicool.com/">Digital Creations, Inc.</a> All rights reserved.</P> </BODY> </HTML> <!-- Traceback (innermost last): File /usr/local/dc/zope-2.1.x/lib/python/ZPublisher/Publish.py, line 214, in publish_module File /usr/local/dc/zope-2.1.x/lib/python/ZPublisher/Publish.py, line 179, in publish File /disks/slab/dc/zope20-update/lib/python/Zope/__init__.py, line 202, in zpublisher_exception_hook (Object: ApplicationDefaultPermissions) File /usr/local/dc/zope-2.1.x/lib/python/ZPublisher/Publish.py, line 151, in publish File /usr/local/dc/zope-2.1.x/lib/python/ZPublisher/BaseRequest.py, line 308, in traverse File OFS/Application.py, line 249, in __bobo_traverse__ (Object: ApplicationDefaultPermissions) File /disks/slab/dc/zope20-update/lib/python/ZPublisher/HTTPResponse.py, line 509, in notFoundError NotFound: (see above) -->