magic-removal: Fixed #1447 -- More old-style DB API fixes. Thanks, russell@hbd

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2475 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2006-03-02 15:49:30 +00:00
parent 85f7fba723
commit 650b042001
3 changed files with 3 additions and 3 deletions

View File

@ -8,7 +8,7 @@ def shortcut(request, content_type_id, object_id):
"Redirect to an object's page based on a content-type ID and an object ID." "Redirect to an object's page based on a content-type ID and an object ID."
# Look up the object, making sure it's got a get_absolute_url() function. # Look up the object, making sure it's got a get_absolute_url() function.
try: try:
content_type = ContentType.objects.get_object(pk=content_type_id) content_type = ContentType.objects.get(pk=content_type_id)
obj = content_type.get_object_for_this_type(pk=object_id) obj = content_type.get_object_for_this_type(pk=object_id)
except ObjectDoesNotExist: except ObjectDoesNotExist:
raise http.Http404, "Content type %s object %s doesn't exist" % (content_type_id, object_id) raise http.Http404, "Content type %s object %s doesn't exist" % (content_type_id, object_id)

View File

@ -171,7 +171,7 @@ def delete_object(request, model, post_delete_redirect,
raise AttributeError("Generic delete view must be called with either an object_id or a slug/slug_field") raise AttributeError("Generic delete view must be called with either an object_id or a slug/slug_field")
lookup_kwargs.update(extra_lookup_kwargs) lookup_kwargs.update(extra_lookup_kwargs)
try: try:
object = model._default_manager.get_object(**lookup_kwargs) object = model._default_manager.get(**lookup_kwargs)
except ObjectDoesNotExist: except ObjectDoesNotExist:
raise Http404, "No %s found for %s" % (model._meta.app_label, lookup_kwargs) raise Http404, "No %s found for %s" % (model._meta.app_label, lookup_kwargs)

View File

@ -18,7 +18,7 @@ class PasswordResetForm(forms.Manipulator):
def isValidUserEmail(self, new_data, all_data): def isValidUserEmail(self, new_data, all_data):
"Validates that a user exists with the given e-mail address" "Validates that a user exists with the given e-mail address"
try: try:
self.user_cache = User.objects.get_object(email__iexact=new_data) self.user_cache = User.objects.get(email__iexact=new_data)
except User.DoesNotExist: except User.DoesNotExist:
raise validators.ValidationError, "That e-mail address doesn't have an associated user acount. Are you sure you've registered?" raise validators.ValidationError, "That e-mail address doesn't have an associated user acount. Are you sure you've registered?"