Make all URLs reachable
authorMikko Värri <vmj@linuxbox.fi>
Tue, 21 Sep 2010 00:01:29 +0000 (03:01 +0300)
committerMikko Värri <vmj@linuxbox.fi>
Tue, 21 Sep 2010 00:01:29 +0000 (03:01 +0300)
recycloid_api/templates/recycloid_api/response.json
recycloid_api/templates/recycloid_api/response.xml
recycloid_api/urls.py

index 883b6c2..79a98a7 100644 (file)
@@ -22,7 +22,9 @@
                     "links": {
                         "self": { "@href": "{% url recycloid-api-server server.uuid %}" },
                         "owners": { "@href": "{% url recycloid-api-server server.uuid %}owners/" },
-                        "stashes": { "@href": "{% url recycloid-api-server server.uuid %}stashes/" }
+                        "stashes": { "@href": "{% url recycloid-api-server server.uuid %}stashes/" },
+                        "items": { "@href": "{% url recycloid-api-server server.uuid %}items/" },
+                        "images": { "@href": "{% url recycloid-api-server server.uuid %}images/" }
                     }
                 },
 {% endfor %}
                     "image": "{{ owner.thumbnail }}",
                     "links": {
                         "self": { "@href": "{% url recycloid-api-owner owner.uuid %}" },
+                        "server": { "@href": "{% url recycloid-api-server owner.server.uuid %}" },
                         "stashes": { "@href": "{% url recycloid-api-owner owner.uuid %}stashes/" },
-                        "server": { "@href": "{% url recycloid-api-server owner.server.uuid %}" }
+                        "items": { "@href": "{% url recycloid-api-owner owner.uuid %}items/" },
+                        "images": { "@href": "{% url recycloid-api-owner owner.uuid %}images/" }
                     }
                 },
 {% endfor %}
@@ -57,7 +61,6 @@
                 {
                     "@uuid": "{{ stash.uuid }}",
                     "@owner": "{{ stash.owner.uuid }}",
-                    "@server": "{{ stash.server.uuid }}",
                     "title": "{{ stash.title|escape }}",
                     "description": "{{ stash.description|escape }}",
                     "image": "{{ stash.thumbnail }}",
                     "items": { "@items": "{{ stash.item_count }}" },
                     "links": {
                         "self": { "@href": "{% url recycloid-api-stash stash.uuid %}" },
-                        "items": { "@href": "{% url recycloid-api-stash stash.uuid %}items/" },
+                        "server": { "@href": "{% url recycloid-api-server stash.owner.server.uuid %}" },
                         "owner": { "@href": "{% url recycloid-api-owner stash.owner.uuid %}" },
+                        "items": { "@href": "{% url recycloid-api-stash stash.uuid %}items/" },
+                        "images": { "@href": "{% url recycloid-api-stash stash.uuid %}images/" }
                     }
                 },
 {% endfor %}
                     "image": "{{ item.thumbnail }}",
                     "links": {
                         "self": { "@href": "{% url recycloid-api-item item.uuid %}" },
-                        "images": { "@href": "{% url recycloid-api-item item.uuid %}images/" },
-                        "stash": { "@href": "{% url recycloid-api-stash item.stash.uuid %}" }
+                        "server": { "@href": "{% url recycloid-api-server item.stash.owner.server.uuid %}" },
+                        "owner": { "@href": "{% url recycloid-api-owner item.stash.owner.uuid %}" },
+                        "stash": { "@href": "{% url recycloid-api-stash item.stash.uuid %}" },
+                        "images": { "@href": "{% url recycloid-api-item item.uuid %}images/" }
                     }
                 },
 {% endfor %}
                     "url": "{{ image.url }}",
                     "links": {
                         "self": { "@href": "{% url recycloid-api-image image.uuid %}" },
+                        "server": { "@href": "{% url recycloid-api-server image.item.stash.owner.server.uuid %}" },
+                        "owner": { "@href": "{% url recycloid-api-owner image.item.stash.owner.uuid %}" },
+                        "stash": { "@href": "{% url recycloid-api-stash image.item.stash.uuid %}" },
                         "item": { "@href": "{% url recycloid-api-item image.item.uuid %}" }
                     }
                 },
index 4c30a91..25b6d58 100644 (file)
             <url>{{ server.url }}</url>
             <links>
                 <self href="{% url recycloid-api-server server.uuid %}" />
-                <stashes href="{% url recycloid-api-server server.uuid %}stashes/" />
                 <owners href="{% url recycloid-api-server server.uuid %}owners/" />
+                <stashes href="{% url recycloid-api-server server.uuid %}stashes/" />
+                <items href="{% url recycloid-api-server server.uuid %}items/" />
+                <images href="{% url recycloid-api-server server.uuid %}images/" />
             </links>
         </server>
     {% endfor %}
             <image>{{ owner.thumbnail }}</image>
             <links>
                 <self href="{% url recycloid-api-owner owner.uuid %}" />
-                <stashes href="{% url recycloid-api-owner owner.uuid %}stashes/" />
                 <server href="{% url recycloid-api-server owner.server.uuid %}" />
+                <stashes href="{% url recycloid-api-owner owner.uuid %}stashes/" />
+                <items href="{% url recycloid-api-owner owner.uuid %}items/" />
+                <images href="{% url recycloid-api-owner owner.uuid %}images/" />
             </links>
         </owner>
     {% endfor %}
@@ -40,7 +44,7 @@
 {% if stashes|defined %}
     <stashes href="{% url recycloid-api-stashes %}">
     {% for stash in stashes %}
-        <stash uuid="{{ stash.uuid }}" owner="{{ stash.owner.uuid }}" server="{{ stash.server.uuid }}">
+        <stash uuid="{{ stash.uuid }}" owner="{{ stash.owner.uuid }}">
             <title>{{ stash.title|escape }}</title>
             <description>{{ stash.description|escape }}</description>
             <image>{{ stash.thumbnail }}</image>
             <items items="{{ stash.item_count }}" />
             <links>
                 <self href="{% url recycloid-api-stash stash.uuid %}" />
-                <items href="{% url recycloid-api-stash stash.uuid %}items/" />
+                <server href="{% url recycloid-api-server stash.owner.server.uuid %}" />
                 <owner href="{% url recycloid-api-owner stash.owner.uuid %}" />
+                <items href="{% url recycloid-api-stash stash.uuid %}items/" />
+                <images href="{% url recycloid-api-stash stash.uuid %}images/" />
             </links>
         </stash>
     {% endfor %}
             <image>{{ item.thumbnail }}</image>
             <links>
                 <self href="{% url recycloid-api-item item.uuid %}" />
-                <images href="{% url recycloid-api-item item.uuid %}images/" />
+                <server href="{% url recycloid-api-server item.stash.owner.server.uuid %}" />
+                <owner href="{% url recycloid-api-owner item.stash.owner.uuid %}" />
                 <stash href="{% url recycloid-api-stash item.stash.uuid %}" />
+                <images href="{% url recycloid-api-item item.uuid %}images/" />
             </links>
         </item>
     {% endfor %}
@@ -84,6 +92,9 @@
             <url>{{ image.url }}</url>
             <links>
                 <self href="{% url recycloid-api-image image.uuid %}" />
+                <server href="{% url recycloid-api-server image.item.stash.owner.server.uuid %}" />
+                <owner href="{% url recycloid-api-owner image.item.stash.owner.uuid %}" />
+                <stash href="{% url recycloid-api-stash image.item.stash.uuid %}" />
                 <item href="{% url recycloid-api-item image.item.uuid %}" />
             </links>
         </image>
index 20d0d21..46d3cc8 100644 (file)
@@ -13,38 +13,22 @@ urlpatterns = patterns('recycloid_api.views',
         url(r'^$', 'index', name='recycloid-api-index'),
         url(r'^servers/$', 'servers', name='recycloid-api-servers'),
         url(r'^servers/' + server + r'/$', 'servers', name='recycloid-api-server'),
-        url(r'^servers/' + server + r'/stashes/$', 'stashes'),
-        url(r'^servers/' + server + r'/stashes/' + stash + r'/$', 'stashes'),
-        url(r'^servers/' + server + r'/stashes/' + stash + r'/items/$', 'items'),
-        url(r'^servers/' + server + r'/stashes/' + stash + r'/items/' + item + r'/$', 'items'),
-        url(r'^servers/' + server + r'/stashes/' + stash + r'/items/' + item + r'/images/$', 'images'),
-        url(r'^servers/' + server + r'/stashes/' + stash + r'/items/' + item + r'/images/' + image + r'/$', 'images'),
         url(r'^servers/' + server + r'/owners/$', 'owners'),
-        url(r'^servers/' + server + r'/owners/' + owner + r'/$', 'owners'),
-        url(r'^servers/' + server + r'/owners/' + owner + r'/stashes/$', 'stashes'),
-        url(r'^servers/' + server + r'/owners/' + owner + r'/stashes/' + stash + r'/$', 'stashes'),
-        url(r'^servers/' + server + r'/owners/' + owner + r'/stashes/' + stash + r'/items/$', 'items'),
-        url(r'^servers/' + server + r'/owners/' + owner + r'/stashes/' + stash + r'/items/' + item + r'/$', 'items'),
-        url(r'^servers/' + server + r'/owners/' + owner + r'/stashes/' + stash + r'/items/' + item + r'/images/$', 'images'),
-        url(r'^servers/' + server + r'/owners/' + owner + r'/stashes/' + stash + r'/items/' + item + r'/images/' + image + r'/$', 'images'),
+        url(r'^servers/' + server + r'/stashes/$', 'stashes'),
+        url(r'^servers/' + server + r'/items/$', 'items'),
+        url(r'^servers/' + server + r'/images/$', 'images'),
         url(r'^owners/$', 'owners', name='recycloid-api-owners'),
         url(r'^owners/' + owner + r'/$', 'owners', name='recycloid-api-owner'),
         url(r'^owners/' + owner + r'/stashes/$', 'stashes'),
-        url(r'^owners/' + owner + r'/stashes/' + stash + r'/$', 'stashes'),
-        url(r'^owners/' + owner + r'/stashes/' + stash + r'/items/$', 'items'),
-        url(r'^owners/' + owner + r'/stashes/' + stash + r'/items/' + item + r'/$', 'items'),
-        url(r'^owners/' + owner + r'/stashes/' + stash + r'/items/' + item + r'/images/$', 'images'),
-        url(r'^owners/' + owner + r'/stashes/' + stash + r'/items/' + item + r'/images/' + image + r'/$', 'images'),
+        url(r'^owners/' + owner + r'/items/$', 'items'),
+        url(r'^owners/' + owner + r'/images/$', 'images'),
         url(r'^stashes/$', 'stashes', name='recycloid-api-stashes'),
         url(r'^stashes/' + stash + r'/$', 'stashes', name='recycloid-api-stash'),
         url(r'^stashes/' + stash + r'/items/$', 'items'),
-        url(r'^stashes/' + stash + r'/items/' + item + r'/$', 'items'),
-        url(r'^stashes/' + stash + r'/items/' + item + r'/images/$', 'images'),
-        url(r'^stashes/' + stash + r'/items/' + item + r'/images/' + image + r'/$', 'images'),
+        url(r'^stashes/' + stash + r'/images/$', 'images'),
         url(r'^items/$', 'items', name='recycloid-api-items'),
         url(r'^items/' + item + r'/$', 'items', name='recycloid-api-item'),
         url(r'^items/' + item + r'/images/$', 'images'),
-        url(r'^items/' + item + r'/images/' + image + r'/$', 'images'),
         url(r'^images/$', 'images', name='recycloid-api-images'),
         url(r'^images/' + image + r'/$', 'images', name='recycloid-api-image'),
 )