views: when a document is not found report if the document doest not exist of if the user does not have access to it

fixes #4225
This commit is contained in:
Benjamin Dauvergne 2014-01-24 15:26:47 +01:00
parent 2483aaf31e
commit 0c5d03a57c
1 changed files with 10 additions and 1 deletions

View File

@ -246,7 +246,16 @@ def message(request, mailbox_id, outbox=False):
try:
document = get_document(request, mailbox_id, outbox)
except Document.DoesNotExist:
raise Http404
if Document.objects.filter(pk=mailbox_id):
messages.warning(request,
_('You cannot see this document as you are not the recipient'))
else:
messages.warning(request,
_('Document not found'))
if outbox:
return redirect('outbox')
else:
return redirect('inbox')
if outbox:
back_pair = (reverse('outbox'), gettext_noop('back to outbox'))
else: