コード例 #1
0
    def _dispatch_request(self, request, response):
        directory = self.configuration['upload_directory']
        if request.method == 'GET':
            return
        elif request.method != 'POST':
            raise MethodNotAllowed()

        mapping = {}
        for name, uploaded_file in request.files.iteritems():
            filename = mapping[name] = '%s_%s' % (
                uniqid(), secure_filename(uploaded_file.filename))
            uploaded_file.save(os.path.join(directory, filename))

        response.mimetype = 'text/html'
        response.data = Json.serialize(mapping)
コード例 #2
0
    def _dispatch_request(self, request, response):
        directory = self.configuration['upload_directory']
        if request.method == 'GET':
            return
        elif request.method != 'POST':
            raise MethodNotAllowed()

        mapping = {}
        for name, uploaded_file in request.files.iteritems():
            filename = mapping[name] = '%s_%s' % (
                uniqid(), secure_filename(uploaded_file.filename))
            uploaded_file.save(os.path.join(directory, filename))

        response.mimetype = 'text/html'
        response.data = Json.serialize(mapping)
コード例 #3
0
ファイル: registration.py プロジェクト: siq-legacy/spire
 def _prepare_response(self, response, content):
     response.mimetype = 'application/json'
     response.data = Json.serialize(content)
コード例 #4
0
ファイル: registration.py プロジェクト: esho/spire
 def _prepare_response(self, response, content):
     response.mimetype = 'application/json'
     response.data = Json.serialize(content)