def write(self, obj):
        """ Print object on output """
        accept = self.request.headers.get("Accept")
        if "json" in accept:
            if JsonDefaultHandler.__parser is None:
                JsonDefaultHandler.__parser = Parser()
            super(JsonDefaultHandler, self).write(JsonDefaultHandler.__parser.encode(obj))
            return
        # If we are not in json mode
        super(JsonDefaultHandler, self).write(obj)
def write ( self , obj ) : accept = self . request . headers . get ( "Accept" ) if "json" in accept : if JsonDefaultHandler . __parser is None : JsonDefaultHandler . __parser = Parser ( ) super ( JsonDefaultHandler , self ) . write ( JsonDefaultHandler . __parser . encode ( obj ) ) return super ( JsonDefaultHandler , self ) . write ( obj )
Print object on output