RE: [Zope] Custom 404 html message
At 09:19 14/02/2002 -0800, Chris A. Bruce wrote:
I know about that, but what if I want a error message specifically for 404 and nothing else?
Taking the basic standard_error_message and changing like this might work: <dtml-if "error_type == 'NotFound'"> <dtml-comment> Add special handling for 404 Not found here </dtml-comment> <dtml-else> <dtml-comment> Put the contents of the default standard_error_message DTML method here </dtml-comment> </dtml-if>
-----Original Message----- From: Richard Barrett [mailto:R.Barrett@ftel.co.uk] Sent: Thursday, February 14, 2002 9:17 AM To: Chris A. Bruce; zope@zope.org Subject: Re: [Zope] Custom 404 html message
At 09:04 14/02/2002 -0800, Chris A. Bruce wrote:
Is there a way to customize a page not found error?
I found editing or creating a dtml method called standard_error_message worked just fine. You should have one (the basic default) lurking somewhere in your zope database.
Chris Bruce Director of Information Technology The Sleeter Group 925-416-6300 cbruce@sleeter.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Richard Barrett wrote:
Taking the basic standard_error_message and changing like this might work:
<dtml-if "error_type == 'NotFound'"> <dtml-comment> Add special handling for 404 Not found here </dtml-comment> <dtml-else> <dtml-comment> Put the contents of the default standard_error_message DTML method here </dtml-comment> </dtml-if>
*vomit* ;-) Put a python script in which calls the appropriate ZPT for an error message or have the python script do other processing (such as a redirect) if you don't want an error message shown. cheers, Chris
Hi, as 404 is a question here I would like to add one: I customized my error page and it works fine when for example my database method fails I get a nice error message. But with 404 I get a Zope builtin message and nothing close to what I intended. Any ideas? Thanks Ulli
if there is an error processing your customized error page zope will fall back to its built-in error message code from the file system. jens On Thursday, February 14, 2002, at 04:13 , Ulrich Wisser wrote:
Hi,
as 404 is a question here I would like to add one:
I customized my error page and it works fine when for example my database method fails I get a nice error message. But with 404 I get a Zope builtin message and nothing close to what I intended.
Any ideas?
Thanks
Ulli
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
At 19:13 14/02/2002 +0000, Chris Withers wrote:
Richard Barrett wrote:
Taking the basic standard_error_message and changing like this might work:
<dtml-if "error_type == 'NotFound'"> <dtml-comment> Add special handling for 404 Not found here </dtml-comment> <dtml-else> <dtml-comment> Put the contents of the default standard_error_message DTML
method here
</dtml-comment> </dtml-if>
*vomit* ;-)
Excellent. Well framed constructive explanation for your objections.
Put a python script in which calls the appropriate ZPT for an error message or have the python script do other processing (such as a redirect) if you don't want an error message shown.
I'm pleased to see proposed a straightforward alternative that easy for the average bear in a hurry to implement. I take it this is the ZPT whose description and examples of use feature so strongly in all of the books on Zope that have been published to date. What was that you said? Oh, you mean that I have to spend _all_ my time keeping abreast of where Zope is going and all of its great new developments and shouldn't be doing anything else. Problem I have as regards to Zope is that my employer wants results today, well actually he wanted them yesterday; another photograph of some more jelly nailed to the tree has ceased to be acceptable as a deliverable.
cheers,
Chris
Regard Richard
On Mon, 18 Feb 2002 21:29, Richard Barrett wrote:
At 19:13 14/02/2002 +0000, Chris Withers wrote:
Richard Barrett wrote:
Taking the basic standard_error_message and changing like this might work:
<dtml-if "error_type == 'NotFound'"> <dtml-comment> Add special handling for 404 Not found here </dtml-comment> <dtml-else> <dtml-comment> Put the contents of the default standard_error_message DTML
method here
</dtml-comment> </dtml-if>
*vomit* ;-)
Excellent. Well framed constructive explanation for your objections.
I concur with his excellent, concise argument against DTML-as-logic :)
Put a python script in which calls the appropriate ZPT for an error message or have the python script do other processing (such as a redirect) if you don't want an error message shown.
Sorry, missed this comment when it was originally posted. Don't forget that most current Zopes won't let you use a Python Script as your standard_error_message - it MUST be a DTML Method - no other meta_type will be recognised. This has been fixed in 2.5 and _possibly_ 2.4.4(?) Richard
Richard Barrett wrote:
I take it this is the ZPT whose description and examples of use feature so strongly in all of the books on Zope that have been published to date.
Well look, if you wanna make an unmaintainable mess that comes back to bite you next time your employer asks you for something on short notice, then stick with DTML, I'm just trying to help you out. No, it doesn't feature in any paper books currently published (well, that's actually not true, it's in at least one or two of the Zope books I've seen) but that's 'cos they were all written about 6 months ago. It does have plenty of examples (including Peter's guide to turning common DTML idioms into ZPT) and the language reference in the wiki is all I've needed.
What was that you said? Oh, you mean that I have to spend _all_ my time keeping abreast of where Zope is going and all of its great new developments and shouldn't be doing anything else.
It's not like I suggested you should be using Zope 3 or something. If you wanna be sarcy, then fine, but don't expect much help from people who aren't getting paid to answer questions on this list in future. cheers, Chris
At 11:45 19/02/2002 +0000, Chris Withers wrote:
Richard Barrett wrote:
I take it this is the ZPT whose description and examples of use feature so strongly in all of the books on Zope that have been published to date.
Well look, if you wanna make an unmaintainable mess that comes back to bite you next time your employer asks you for something on short notice, then stick with DTML, I'm just trying to help you out.
How do you reach the conclusion that editing either the sole copy of standard_error_message in the server tree or positioning an edited version of standard_error_message at a strategic point in the server tree to affect error handling below it is creating the unmaintainable mess you are talking about? If that is the case then I suspect there are a lot bigger problems extant on most Zope servers. If DTML is such a disaster then a whole lot of people are a long way along the path to oblivion by now. Hell of a time to tell us it was all a big mistake.
No, it doesn't feature in any paper books currently published (well, that's actually not true, it's in at least one or two of the Zope books I've seen) but that's 'cos they were all written about 6 months ago.
The Zope Book - no mention Zope web application construction kit by Brockman et al - no mention Zope ... - Spicklemire et all - has a short description which is sufficient to highlight the learning curve to adopt "These powerful and promising technologies ..."
It does have plenty of examples (including Peter's guide to turning common DTML idioms into ZPT) and the language reference in the wiki is all I've needed.
What was that you said? Oh, you mean that I have to spend _all_ my time keeping abreast of where Zope is going and all of its great new developments and shouldn't be doing anything else.
It's not like I suggested you should be using Zope 3 or something. If you wanna be sarcy, then fine, but don't expect much help from people who aren't getting paid to answer questions on this list in future.
I doubt anybody posting to this list is getting paid for it. If what I say in a post is wrong then I suggest you EXPLAIN why. Remember you chose to express a value judgement with your *vomit* comment, not offer a fact. Hell I'll happily unsubscribe myself than get that sort of "help". The alternative you offered involved writing a python script and a page template and maybe doing a Zope upgrade as the alternative to using some simple DTML. The new orthodoxy may say that is better but I'm some way from being convinced of it.
participants (5)
-
Chris Withers -
Jens Vagelpohl -
Richard Barrett -
Richard Jones -
Ulrich Wisser