def saveConfig(self, request):
        """I save the config, and run check_config, potencially returning errors"""
        res = yield self.assertAllowed(request)
        if res:
            defer.returnValue(res)
        request.setHeader('Content-Type', 'application/json')
        if self._in_progress:
            defer.returnValue(json.dumps({'success': False, 'errors': ['reconfig already in progress']}))
        self._in_progress = True
        cfg = json.loads(request.content.read())
        if cfg != self._cfg:
            try:
                err = yield self.saveCfg(cfg)
            except Exception as e:  # noqa
                err = [repr(e)]
            if err is not None:
                self._in_progress = False
                yield self.saveCfg(self._cfg)
                defer.returnValue(json.dumps({'success': False, 'errors': err}))

        yield self.ep.master.reconfig()
        defer.returnValue(json.dumps({'success': True}))
def saveConfig ( self , request ) : res = yield self . assertAllowed ( request ) if res : defer . returnValue ( res ) request . setHeader ( 'Content-Type' , 'application/json' ) if self . _in_progress : defer . returnValue ( json . dumps ( { 'success' : False , 'errors' : [ 'reconfig already in progress' ] } ) ) self . _in_progress = True cfg = json . loads ( request . content . read ( ) ) if cfg != self . _cfg : try : err = yield self . saveCfg ( cfg ) except Exception as e : err = [ repr ( e ) ] if err is not None : self . _in_progress = False yield self . saveCfg ( self . _cfg ) defer . returnValue ( json . dumps ( { 'success' : False , 'errors' : err } ) ) yield self . ep . master . reconfig ( ) defer . returnValue ( json . dumps ( { 'success' : True } ) )
I save the config, and run check_config, potencially returning errors