team4alfanous team mailing list archive
-
team4alfanous team
-
Mailing list archive
-
Message #00261
[Branch ~team4alfanous/alfanous/alfanous-git] Rev 446: Implement the JSON output system II using Django, fix #98
------------------------------------------------------------
revno: 446
committer: Assem Chelli <assem.ch@xxxxxxxxx>
timestamp: Fri 2012-11-23 00:16:33 +0100
message:
Implement the JSON output system II using Django, fix #98
Also:
- integrate the search inside the django wui app, now it can process
the search query itself.
modified:
src/alfanous-django/urls.py
src/alfanous-django/wui/views.py
--
lp:alfanous
https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git
Your team Alfanous team is subscribed to branch lp:alfanous.
To unsubscribe from this branch go to https://code.launchpad.net/~team4alfanous/alfanous/alfanous-git/+edit-subscription
=== modified file 'src/alfanous-django/urls.py'
--- src/alfanous-django/urls.py 2012-08-08 23:11:59 +0000
+++ src/alfanous-django/urls.py 2012-11-22 23:16:33 +0000
@@ -8,6 +8,7 @@
# Examples:
# url(r'^$', 'alfanousDjango.views.home', name='home'),
url(r'^wui/', 'alfanous-django.wui.views.results'),
+ url(r'^jos2/', 'alfanous-django.wui.views.jos2'),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
=== modified file 'src/alfanous-django/wui/views.py'
--- src/alfanous-django/wui/views.py 2012-08-08 23:11:59 +0000
+++ src/alfanous-django/wui/views.py 2012-11-22 23:16:33 +0000
@@ -12,13 +12,37 @@
from django.utils.translation import get_language_info
-
-
+import json
+from sys import path
+path.append( "alfanous.egg/alfanous" )
+
+from alfanous.Outputs import Raw
+
+RAWoutput = Raw() #use default paths
+
+def jos2(request):
+ """ JSON Output System II """
+
+ if len( request.GET ):
+ response_data = RAWoutput.do( request.GET )
+ response = HttpResponse(json.dumps(response_data), mimetype="application/json")
+ response['charset'] = 'utf-8'
+ response['Access-Control-Allow-Origin'] = '*'
+ response['Access-Control-Allow-Methods'] = 'GET'
+
+ else:
+ response_data = RAWoutput._information["json_output_system_note"]
+ response = HttpResponse(response_data)
+
+ return response
+
def results(request):
+ response = RAWoutput.do( request.GET )
+
# language information
language = translation.get_language_from_request(request)
language_info = get_language_info(language)