diff options
author | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2012-02-16 15:43:08 +0000 |
---|---|---|
committer | antelder <antelder@13f79535-47bb-0310-9956-ffa450edef68> | 2012-02-16 15:43:08 +0000 |
commit | 08adcf2e783e4733e0fd646d353db3592c62140d (patch) | |
tree | 6e3df9c577025d7f1934b1a3523b20bc7a55df64 /sca-java-2.x/tags/2.0-Beta2-RC1/modules/implementation-python-runtime/src/main/resources/django/utils/simplejson/jsonfilter.py | |
parent | 7c60dda128ad42687f78d62c43603bb5d9e9c263 (diff) |
Delete old RC tags
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1245046 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r-- | sca-java-2.x/tags/2.0-Beta2-RC1/modules/implementation-python-runtime/src/main/resources/django/utils/simplejson/jsonfilter.py | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/implementation-python-runtime/src/main/resources/django/utils/simplejson/jsonfilter.py b/sca-java-2.x/tags/2.0-Beta2-RC1/modules/implementation-python-runtime/src/main/resources/django/utils/simplejson/jsonfilter.py deleted file mode 100644 index d02ae2033a..0000000000 --- a/sca-java-2.x/tags/2.0-Beta2-RC1/modules/implementation-python-runtime/src/main/resources/django/utils/simplejson/jsonfilter.py +++ /dev/null @@ -1,40 +0,0 @@ -from django.utils import simplejson -import cgi - -class JSONFilter(object): - def __init__(self, app, mime_type='text/x-json'): - self.app = app - self.mime_type = mime_type - - def __call__(self, environ, start_response): - # Read JSON POST input to jsonfilter.json if matching mime type - response = {'status': '200 OK', 'headers': []} - def json_start_response(status, headers): - response['status'] = status - response['headers'].extend(headers) - environ['jsonfilter.mime_type'] = self.mime_type - if environ.get('REQUEST_METHOD', '') == 'POST': - if environ.get('CONTENT_TYPE', '') == self.mime_type: - args = [_ for _ in [environ.get('CONTENT_LENGTH')] if _] - data = environ['wsgi.input'].read(*map(int, args)) - environ['jsonfilter.json'] = simplejson.loads(data) - res = simplejson.dumps(self.app(environ, json_start_response)) - jsonp = cgi.parse_qs(environ.get('QUERY_STRING', '')).get('jsonp') - if jsonp: - content_type = 'text/javascript' - res = ''.join(jsonp + ['(', res, ')']) - elif 'Opera' in environ.get('HTTP_USER_AGENT', ''): - # Opera has bunk XMLHttpRequest support for most mime types - content_type = 'text/plain' - else: - content_type = self.mime_type - headers = [ - ('Content-type', content_type), - ('Content-length', len(res)), - ] - headers.extend(response['headers']) - start_response(response['status'], headers) - return [res] - -def factory(app, global_conf, **kw): - return JSONFilter(app, **kw) |