Revision 75768d0e api/images.py
b/api/images.py | ||
---|---|---|
32 | 32 |
# or implied, of GRNET S.A. |
33 | 33 |
|
34 | 34 |
from django.conf.urls.defaults import patterns |
35 |
from django.db.models import Q |
|
35 | 36 |
from django.http import HttpResponse |
36 | 37 |
from django.template.loader import render_to_string |
37 | 38 |
from django.utils import simplejson as json |
... | ... | |
119 | 120 |
# overLimit (413) |
120 | 121 |
|
121 | 122 |
since = util.isoparse(request.GET.get('changes-since')) |
122 |
|
|
123 |
owner = request.user |
|
124 |
|
|
125 |
avail_images = Image.objects.filter(Q(owner=owner) | Q(public=True)) |
|
123 | 126 |
if since: |
124 |
avail_images = Image.objects.filter(owner=request.user, |
|
125 |
updated__gte=since) |
|
127 |
avail_images = avail_images.filter(updated__gte=since) |
|
126 | 128 |
if not avail_images: |
127 | 129 |
return HttpResponse(status=304) |
128 |
else: |
|
129 |
avail_images = Image.objects.filter(owner=request.user) |
|
130 |
|
|
130 |
|
|
131 | 131 |
images = [image_to_dict(image, detail) for image in avail_images] |
132 | 132 |
|
133 | 133 |
if request.serialization == 'xml': |
Also available in: Unified diff