Coder Social home page Coder Social logo

Comments (3)

gilbert-yuan avatar gilbert-yuan commented on September 16, 2024
def _json_response(self, result=None, error=None):
    response = {
        'jsonrpc': '2.0',
        'id': self.jsonrequest.get('id')
    }
    if result and isinstance(result, dict) and result.get('msg_signature'):
        print result
        mime = 'application/json'
        body = json.dumps(result)
        print body
        return Response(
            body, headers=[('Content-Type', mime),
                           ('Content-Length', len(body))])
    if error is not None:
        response['error'] = error
    if result is not None:
        response['result'] = result

    if self.jsonp:
        # If we use jsonp, that's mean we are called from another host
        # Some browser (IE and Safari) do no allow third party cookies
        # We need then to manage http sessions manually.
        response['session_id'] = self.session.sid
        mime = 'application/javascript'
        body = "%s(%s);" % (self.jsonp, json.dumps(response),)
    else:
        mime = 'application/json'
        body = json.dumps(response)

    return Response(
        body, headers=[('Content-Type', mime),
                       ('Content-Length', len(body))])


JsonRequest._json_response = _json_response

from odoo_dingding.

lmarklil avatar lmarklil commented on September 16, 2024

多谢老哥指点😄

from odoo_dingding.

gilbert-yuan avatar gilbert-yuan commented on September 16, 2024

不用客气举手之劳,github消息不多没注意,这么就才回复你。。

from odoo_dingding.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.