correct poi V00.05
authorymh <ymh.work@gmail.com>
Sat, 23 Jan 2010 02:30:34 +0100
changeset 13 de71c188f397
parent 12 9559b87fbe4d
child 14 ddfeb878658a
correct poi
web/blinkster/__init__.py
web/blinkster/config.py.tmpl
web/blinkster/urls.py
web/blinkster/views.py
web/static/css/admin_style.css
--- a/web/blinkster/__init__.py	Fri Jan 22 18:26:49 2010 +0100
+++ b/web/blinkster/__init__.py	Sat Jan 23 02:30:34 2010 +0100
@@ -1,3 +1,3 @@
-VERSION = (0,4)
+VERSION = (0,5)
 
 VERSION_STR = unicode(".".join(map(lambda i:"%02d" % (i,), VERSION)))
--- a/web/blinkster/config.py.tmpl	Fri Jan 22 18:26:49 2010 +0100
+++ b/web/blinkster/config.py.tmpl	Sat Jan 23 02:30:34 2010 +0100
@@ -1,14 +1,15 @@
 import os, logging
 
-BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-BASE_URL = '/~ymh/blinkster/'
-WEB_URL = 'http://localhost'
-MEDIA_BASE_URL = BASE_URL + 'static/media/'
+BASE_DIR = os.path.dirname(os.path.abspath(__file__)).rstrip("/") + "/"
+BASE_URL = '/dev/~ymh/blinkster/'
+WEB_URL = 'http://www.iri.centrepompidou.fr/dev/~ymh/blinkster/'
+MEDIA_BASE_URL = BASE_URL + 'static/'
 STREAM_URL = MEDIA_BASE_URL + "/content/"
 
 # Absolute path to the directory that holds media.
 # Example: "/home/media/media.lawrence.com/"
-# MEDIA_ROOT = os.path.abspath(BASE_DIR + "../static/")
+MEDIA_ROOT = os.path.abspath(BASE_DIR + "../static/")
+
 
 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
 # trailing slash if there is a path component (optional in other cases).
@@ -20,13 +21,13 @@
 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
 # trailing slash.
 # Examples: "http://foo.com/media/", "/media/".
-ADMIN_MEDIA_PREFIX = '/media/'
+ADMIN_MEDIA_PREFIX = BASE_URL + 'static/admin/'
 
 DATABASE_ENGINE = 'postgresql_psycopg2'           # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
 DATABASE_NAME = 'blinkster'             # Or path to database file if using sqlite3.
-DATABASE_USER = 'iri'             # Not used with sqlite3.
-DATABASE_PASSWORD = 'iri'         # Not used with sqlite3.
-DATABASE_HOST = ''             # Set to empty string for localhost. Not used with sqlite3.
+DATABASE_USER = 'iriuser'             # Not used with sqlite3.
+DATABASE_PASSWORD = 'iriuser'         # Not used with sqlite3.
+DATABASE_HOST = '127.0.0.1'             # Set to empty string for localhost. Not used with sqlite3.
 DATABASE_PORT = ''             # Set to empty string for default. Not used with sqlite3.
 
 
--- a/web/blinkster/urls.py	Fri Jan 22 18:26:49 2010 +0100
+++ b/web/blinkster/urls.py	Sat Jan 23 02:30:34 2010 +0100
@@ -39,7 +39,7 @@
     (r'^ldt/projectslist/(?P<content_id>.*)$', 'blinkster.ldt.views.getProjectFromContentId'),
     #(r'^.*(?P<content>flvplayer|mp3player|ClearExternalAllBlue)\.swf$','django.views.generic.simple.redirect_to', {'url':blinkster.settings.BASE_URL+'/static/swf/ldt/pkg/%(content)s.swf'}),
     (r'^roi/list/$', 'blinkster.views.roi_list'),
-    (r'^poi/list/(?P<roi_sid>.*)$', 'blinkster.views.poi_list'),
+    (r'^poi/list/(?P<roi_sid>.*)/$', 'blinkster.views.poi_list'),
     (r'^photologue/', include('photologue.urls')),
     
 )
--- a/web/blinkster/views.py	Fri Jan 22 18:26:49 2010 +0100
+++ b/web/blinkster/views.py	Sat Jan 23 02:30:34 2010 +0100
@@ -1,6 +1,6 @@
 # Create your views here.
 from django.http import HttpResponse, HttpResponseRedirect
-from django.shortcuts import render_to_response
+from django.shortcuts import render_to_response, get_object_or_404
 from django.core.urlresolvers import reverse
 from django.template import RequestContext, TemplateDoesNotExist
 from django.template.loader import get_template
@@ -11,19 +11,23 @@
 from blinkster.models import Roi, Poi
 import blinkster
 
-def serialize_queryset_to_json(response, objects):
+def serialize_queryset_to_json(response, obj_list):
     objs = {
         "version" : blinkster.VERSION,
-        "rois" : objects
+        "list" : obj_list,
     }
     simplejson.dump(objs, response, cls=DjangoJSONEncoder,ensure_ascii=False, indent=4)
     return response
 
 def roi_list(request):
-    response = HttpResponse(content_type="application/json; charset=utf-8")
+
+    content_type = request.GET.get("content-type", "application/json; charset=utf-8")
+
+    response = HttpResponse(content_type=str(content_type))
     return serialize_queryset_to_json(response, [roi.serialize_to_dict() for roi in Roi.objects.all()])
 
 def poi_list(request, roi_sid):
-    response = HttpResponse(content_type="application/json; charset=utf-8")
-    return serialize_queryset_to_json(response, [poi.serialize_to_dict() for poi in Poi.objects.filter(roi__sid=roi_sid)]) 
-    return response
+    content_type = request.GET.get("content-type", "application/json; charset=utf-8")
+    response = HttpResponse(content_type=str(content_type))
+    roi = get_object_or_404(Roi, sid=roi_sid)
+    return serialize_queryset_to_json(response, [poi.serialize_to_dict() for poi in Poi.objects.filter(roi=roi)]) 
--- a/web/static/css/admin_style.css	Fri Jan 22 18:26:49 2010 +0100
+++ b/web/static/css/admin_style.css	Sat Jan 23 02:30:34 2010 +0100
@@ -49,6 +49,7 @@
 .small
 {
 	font-size:9px;
+        text-align: right;
 }
 
 .footer_img