[CalendarServer-dev] Re: [CalendarServer-changes] [1059] CalendarServer/trunk/twistedcaldav/static.py

Cyrus Daboo cdaboo at apple.com
Fri Jan 19 14:06:39 PST 2007


Hi Wilfredo,

--On January 19, 2007 1:33:54 PM -0800 Wilfredo Sánchez Vega 
<wsanchez at wsanchez.net> wrote:

>    Would raising HTTPError(responsecode.NOT_FOUND) be more appropriate
> here?
>
>    I know I haven't defined provisionChild() very well yet, but my
> thinking it that it's not really supposed to be called unless we know the
> child should exist; the caller should expect it to always work.
>
>    Raising should give us a better error result if not handled, where
> returning None might cause some other (more obscure) error down the line.
>
>    I don't know what the error trace looked like, so I might be wrong.

I'm not sure a raise at the point is the right thing to do. In the specific 
case I was trying to deal with, provisionChild is called by locateChild as 
part of the attempt to get the resource for the URI. The "normal" behavior 
of locateChild when it does not find a child is to return None. So I just 
had provisionChild do the same. We could have provisionChild raise, but 
then we ought to catch that in locateChild and not pass it on - just return 
None which is the expected behavior there.

-- 
Cyrus Daboo



More information about the calendarserver-dev mailing list