mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-12-19 08:09:38 +11:00
Simplificiation of a snippet GET. No check for Multiple objects, if it really happens, fail loud.
This commit is contained in:
parent
715be017dd
commit
1069b3a88d
1 changed files with 1 additions and 9 deletions
|
@ -55,15 +55,7 @@ def snippet_details(request, snippet_id, template_name='dpaste/snippet_details.h
|
|||
Details list view of a snippet. Handles the actual view, reply and
|
||||
tree/diff view.
|
||||
"""
|
||||
try:
|
||||
snippet = Snippet.objects.get(secret_id=snippet_id)
|
||||
except MultipleObjectsReturned:
|
||||
raise Http404('Multiple snippets exist for this slug. This should never '
|
||||
'happen but its likely that you are a spam bot, so I dont '
|
||||
'care.')
|
||||
except ObjectDoesNotExist:
|
||||
raise Http404('This snippet does not exist anymore. Its likely that its '
|
||||
'lifetime is expired.')
|
||||
snippet = get_object_or_404(Snippet, secret_id=snippet_id)
|
||||
|
||||
tree = snippet.get_root()
|
||||
tree = tree.get_descendants(include_self=True)
|
||||
|
|
Loading…
Reference in a new issue