[Zope-Coders] Changes to ZPublisher

Donovan Baarda abo at minkirri.apana.org.au
Wed Oct 6 21:44:49 EDT 2004


On Thu, 2004-10-07 at 11:24, Sidnei da Silva wrote:
> | Hmm... didn't notice that... nasty.
> | 
> | So what is the current way for a __bobo_traverse__ to indicate "object
> | does not exist" and result in a 404?
> 
> There's no way :) You could raise NotFound yourself, but then it
> breaks PageTemplates.
> 
> | Perhaps AttributeError = 404 is a good idea after all...
> 
> It's the best I could come up with.

It seems there are several possible solutions to this;

1) Fix PageTemplates so that NotFound doesn't break it (dunno what is
involved).

2) Fix returning None so that it returns 404 instead of "No Docstring",
and introduce some exception for the "No Docstring" case.

3) make AttributeError = 404, and document it like hell so people know
to catch them and raise as some other Error if they don't want a 404.

To me 1) seems like a good idea regardless. For 2) I really don't
understand why None results in "No Docstring"... is this really right?
If NotFound worked, I'm not sure what returning None should mean, but
"No Docstring" doesn't seem to be it. Option 3) seems unattractive to
me.

-- 
Donovan Baarda <abo at minkirri.apana.org.au>
http://minkirri.apana.org.au/~abo/



More information about the Zope-Coders mailing list