#NEWLINE# def get_object_or_404( klass , * args , **kwargs ) : #NEWLINE# #INDENT# '\n    Uses get() to return an object, or raises a Http404 exception if the object\n    does not exist.\n\n    klass may be a Model, Manager, or QuerySet object. All other passed\n    arguments and keyword arguments are used in the get() query.\n\n    Note: Like with get(), an MultipleObjectsReturned will be raised if more than one\n    object is found.\n    ' #NEWLINE# queryset = _get_queryset ( klass ) #NEWLINE# try : #NEWLINE# #INDENT# return queryset . get ( * args , ** kwargs ) #NEWLINE# #UNINDENT# except queryset . model . DoesNotExist : #NEWLINE# #INDENT# raise Http404 ( ( 'No %s matches the given query.' % queryset . model . _meta . object_name ) )