コード例 #1
0
ファイル: base.py プロジェクト: AndreaGiardini/pulp
 def _output(self, data):
     """
     JSON encode the response and set the appropriate headers
     """
     body = json.dumps(data, default=json_encoder)
     http.header('Content-Type', 'application/json')
     http.header('Content-Length', len(body))
     return body
コード例 #2
0
ファイル: base.py プロジェクト: pombreda/pulp
 def _output(self, data):
     """
     JSON encode the response and set the appropriate headers
     """
     body = json.dumps(data, default=json_encoder)
     http.header('Content-Type', 'application/json')
     http.header('Content-Length', len(body))
     return body
コード例 #3
0
ファイル: base.py プロジェクト: AndreaGiardini/pulp
 def created(self, location, data):
     """
     Return a created response.
     @type location: str
     @param location: URL of the created resource
     @type data: mapping type
     @param data: data to be returned in the body of the response
     @return: JSON encoded response
     """
     http.status_created()
     http.header('Location', location)
     return self._output(data)
コード例 #4
0
ファイル: base.py プロジェクト: pombreda/pulp
 def created(self, location, data):
     """
     Return a created response.
     @type location: str
     @param location: URL of the created resource
     @type data: mapping type
     @param data: data to be returned in the body of the response
     @return: JSON encoded response
     """
     http.status_created()
     http.header('Location', location)
     return self._output(data)