equal
deleted
inserted
replaced
3 class JSONMixin: |
3 class JSONMixin: |
4 MIMETYPE = 'application/json' |
4 MIMETYPE = 'application/json' |
5 |
5 |
6 CORS_ORIGIN = None |
6 CORS_ORIGIN = None |
7 CORS_METHODS = None |
7 CORS_METHODS = None |
|
8 CORS_HEADERS = None |
|
9 CORS_CREDENTIALS = None |
8 |
10 |
9 def headers (self): |
11 def headers (self): |
10 if self.CORS_ORIGIN: |
12 if self.CORS_ORIGIN: |
11 yield 'Access-Control-Allow-Origin', self.CORS_ORIGIN |
13 yield 'Access-Control-Allow-Origin', self.CORS_ORIGIN |
12 |
14 |
13 if self.CORS_METHODS: |
15 if self.CORS_METHODS: |
14 yield 'Access-Control-Allow-Methods', ', '.join(self.CORS_METHODS) |
16 yield 'Access-Control-Allow-Methods', ', '.join(self.CORS_METHODS) |
|
17 |
|
18 if self.CORS_HEADERS: |
|
19 yield 'Access-Control-Allow-Headers', ', '.join(self.CORS_HEADERS) |
|
20 |
|
21 if self.CORS_CREDENTIALS: |
|
22 yield 'Access-Control-Allow-Credentials', 'true' |
15 |
23 |
16 def render_json(self, **parms): |
24 def render_json(self, **parms): |
17 raise NotImplementedError() |
25 raise NotImplementedError() |
18 |
26 |
19 def render_response(self, **params): |
27 def render_response(self, **params): |