def _resolve_lookup((model, lookup, arg_name), view_kwargs):
 value = view_kwargs.get(arg_name)
 if (value is None):
  raise ValueError(("Expected kwarg '%s' not found." % arg_name))
 if isinstance(model, basestring):
  model_class = get_model(*model.split('.'))
 else:
  model_class = model
 if (model_class is None):
  raise ValueError(("The given argument '%s' is not a valid model." % model))
 if (inspect.isclass(model_class) and (not issubclass(model_class, Model))):
  raise ValueError(("The argument '%s' needs to be a model." % model))
 return get_object_or_404(model_class, **{lookup: value})

def _resolve_lookup ( ( model , lookup , arg_name ) , view_kwargs ) : value = view_kwargs . get ( arg_name ) if ( value is None ) : raise ValueError ( ( "Expected kwarg '%s' not found." % arg_name ) ) if isinstance ( model , basestring ) : model_class = get_model ( * model . split ( '.' ) ) else : model_class = model if ( model_class is None ) : raise ValueError ( ( "The given argument '%s' is not a valid model." % model ) ) if ( inspect . isclass ( model_class ) and ( not issubclass ( model_class , Model ) ) ) : raise ValueError ( ( "The argument '%s' needs to be a model." % model ) ) return get_object_or_404 ( model_class , ** { lookup : value } )
return the object indicated by the lookup triple and the kwargs passed to the view .