ojengwa / pleft

Automatically exported from code.google.com/p/pleft
GNU General Public License v3.0
1 stars 0 forks source link

Error (EXTERNAL IP): /data #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Not sure how this could happen...

--

Traceback (most recent call last):

 File "/home/sander/tmp/dkp-db/django/core/handlers/base.py", line 100, in get_response
   response = callback(request, *callback_args, **callback_kwargs)

 File "/home/sander/tmp/dkp-db/django/views/decorators/cache.py", line 69, in _wrapped_view_func
   response = view_func(request, *args, **kwargs)

 File "/home/sander/deploy/pleft/plapp/views.py", line 144, in appointment_data
   appointment, user, invitee = _get_appointment_or_404(request)

 File "/home/sander/deploy/pleft/plapp/views.py", line 57, in _get_appointment_or_404
   invitee = models.Invitee.objects.all().get(appointment=appointment, user=user)

 File "/home/sander/tmp/dkp-db/django/db/models/query.py", line 341, in get
   % self.model._meta.object_name)

DoesNotExist: Invitee matching query does not exist.

Original issue reported on code.google.com by sander.d...@gmail.com on 13 Mar 2011 at 5:36

GoogleCodeExporter commented 9 years ago
Currently fixed in an ugly way in plapp/views.py, see below. Apparently I was 
using the wrong way to check whether an object exists, perhaps still coming 
from the old App Engine code. Need to put this into a nice patch.

from django.core.exceptions import ObjectDoesNotExist

def _get_appointment_or_404(request):
    if request.method == 'POST':
        params = request.POST
    else:
        params = request.GET

    if not 'id' in params:
        raise http.Http404

    try:
        appointment = models.Appointment.objects.all().get(id=int(params['id']))
        if not appointment or not appointment.visible:
            raise http.Http404
    except ObjectDoesNotExist:
        raise http.Http404

    user = plauth.models.User.get_signed_in(request)
    if not user:
        raise exceptions.PermissionDenied

    try:
        invitee = models.Invitee.objects.all().get(appointment=appointment, user=user)
        if not invitee:
            raise http.Http404
    except ObjectDoesNotExist:
        raise http.Http404

    return (appointment, user, invitee)

Original comment by sander.d...@gmail.com on 23 Mar 2011 at 1:06

GoogleCodeExporter commented 9 years ago
To be fixed with this commit:
https://github.com/sander/pleft/commit/c602b553dd37b057f8ecd75b8732a795447ec113

Original comment by sander.d...@gmail.com on 13 Nov 2011 at 8:21

GoogleCodeExporter commented 9 years ago
Fixed in http://tryout.pleft.com/

Original comment by sander.d...@gmail.com on 27 Nov 2011 at 4:06