I wonder if with the new "with syntax", you could do something like:
with 404_on_error: Articles.objects.filter(name__startswith="Whatever") That'd be sweet. On 1/31/06, Robert Wittams <[EMAIL PROTECTED]> wrote: > > I think Lukes ideas are probably the way forward. > > However, another possibility would be a 404 wrapper for a set, eg > > 404_on_error(Articles.objects).filter(name__startswith="Whatever") > > Effectively this creates a version of the "set" that has a different > error policy. Not sure if this would work in practice (needs thought) , > but it seems quite general. This could be implemented either by > centralising the error handling and allowing it to be customised on a > copy of the QuerySet, or by holding a reference to the query set, > delegating most functions by wrapping functions that might throw > ObjectDoesNotExist ( __iter__ etc). > > The main issue I have with this is : is it a shortcut anymore? It does > still cut down on try/catch malarkeys, but... not sure. > >