projects
/
htsworkflow.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
49798d7
)
Fixed json library stuff
author
Brandon King
<kingb@caltech.edu>
Tue, 7 Jul 2009 22:55:08 +0000
(22:55 +0000)
committer
Brandon King
<kingb@caltech.edu>
Tue, 7 Jul 2009 22:55:08 +0000
(22:55 +0000)
samplebc/bcmagic/views.py
patch
|
blob
|
history
diff --git
a/samplebc/bcmagic/views.py
b/samplebc/bcmagic/views.py
index 0b0a2bc19d2324cd99d37fb2e70d41bd0adcd775..9bc9a032c3b755622e4ef772c99385c5ad644496 100644
(file)
--- a/
samplebc/bcmagic/views.py
+++ b/
samplebc/bcmagic/views.py
@@
-7,9
+7,13
@@
from samplebc.bcmagic import models
from samplebc.bcmagic.utils import report_error, redirect_to_url
from samplebc.bcmagic.plugin import bcm_plugin_processor
from samplebc.bcmagic.utils import report_error, redirect_to_url
from samplebc.bcmagic.plugin import bcm_plugin_processor
-import json
import re
import re
+try:
+ import json
+except ImportError, e:
+ import simplejson as json
+
from samplebc.bcmagic import forms
def index(request):
from samplebc.bcmagic import forms
def index(request):
@@
-90,7
+94,7
@@
def magic(request):
if text is None or text.strip() == '':
d['mode'] = 'Error'
d['status'] = 'Did not recieve text'
if text is None or text.strip() == '':
d['mode'] = 'Error'
d['status'] = 'Did not recieve text'
- return HttpResponse(json.
write
(d), 'text/plain')
+ return HttpResponse(json.
dumps
(d), 'text/plain')
# Did not receive bcm_mode error
if bcm_mode is None or bcm_mode.strip() == '':
# Did not receive bcm_mode error
if bcm_mode is None or bcm_mode.strip() == '':
@@
-116,7
+120,7
@@
def magic(request):
else:
d = __magic_process(text)
else:
d = __magic_process(text)
- return HttpResponse(json.
write
(d), 'text/plain')
+ return HttpResponse(json.
dumps
(d), 'text/plain')
@@
-128,11
+132,11
@@
def json_test(request):
else:
text = None
else:
text = None
- #return HttpResponse(json.
write
(request.POST.items()), 'text/plain')
+ #return HttpResponse(json.
dumps
(request.POST.items()), 'text/plain')
if text is None or text.strip() == '':
d['mode'] = 'Error'
d['status'] = 'Did not recieve text'
if text is None or text.strip() == '':
d['mode'] = 'Error'
d['status'] = 'Did not recieve text'
- return HttpResponse(json.
write
(d), 'text/plain')
+ return HttpResponse(json.
dumps
(d), 'text/plain')
if text.split('|')[0] == 'url':
d['mode'] = 'redirect'
if text.split('|')[0] == 'url':
d['mode'] = 'redirect'
@@
-141,4
+145,4
@@
def json_test(request):
d['msg'] = 'Recieved text: %s' % (text)
d['mode'] = 'clear'
d['msg'] = 'Recieved text: %s' % (text)
d['mode'] = 'clear'
- return HttpResponse(json.
write
(d), 'text/plain')
+ return HttpResponse(json.
dumps
(d), 'text/plain')