Revision c5a032c4 api/handlers.py
b/api/handlers.py | ||
---|---|---|
128 | 128 |
|
129 | 129 |
@paginator |
130 | 130 |
def read_all(self, request, detail=False): |
131 |
#changes_since should be on ISO 8601 format |
|
131 | 132 |
try: |
132 | 133 |
changes_since = request.GET.get("changes-since", 0) |
133 | 134 |
if changes_since: |
134 |
last_update = datetime.fromtimestamp(int(changes_since))
|
|
135 |
last_update = datetime.strptime(changes_since, "%Y-%m-%dT%H:%M:%S" )
|
|
135 | 136 |
virtual_servers = VirtualMachine.objects.filter(updated__gt=last_update) |
136 | 137 |
if not len(virtual_servers): |
137 | 138 |
return notModified |
... | ... | |
631 | 632 |
Faults: cloudServersFault, serviceUnavailable, unauthorized, |
632 | 633 |
badRequest, itemNotFound |
633 | 634 |
""" |
635 |
|
|
636 |
#changes_since should be on ISO 8601 format |
|
637 |
try: |
|
638 |
changes_since = request.GET.get("changes-since", 0) |
|
639 |
if changes_since: |
|
640 |
last_update = datetime.strptime(changes_since, "%Y-%m-%dT%H:%M:%S" ) |
|
641 |
images = Image.objects.filter(updated__gt=last_update) |
|
642 |
if not len(images): |
|
643 |
return notModified |
|
644 |
else: |
|
645 |
images = Image.objects.all() |
|
646 |
except Exception, e: |
|
647 |
raise fault.badRequest |
|
634 | 648 |
try: |
635 |
images = Image.objects.all() |
|
636 | 649 |
images_list = [ {'created': image.created.isoformat(), |
637 | 650 |
'id': image.id, |
638 | 651 |
'name': image.name, |
Also available in: Unified diff