def post(self):
        '''This handles POST requests.

        Saves the changes made by the user on the frontend back to the current
        checkplot-list.json file.

        '''

        # if self.readonly is set, then don't accept any changes
        # return immediately with a 400
        if self.readonly:

            msg = "checkplotserver is in readonly mode. no updates allowed."
            resultdict = {'status':'error',
                          'message':msg,
                          'readonly':self.readonly,
                          'result':None}

            self.write(resultdict)
            raise tornado.web.Finish()


        objectid = self.get_argument('objectid', None)
        changes = self.get_argument('changes',None)

        # if either of the above is invalid, return nothing
        if not objectid or not changes:

            msg = ("could not parse changes to the checkplot filelist "
                   "from the frontend")
            LOGGER.error(msg)
            resultdict = {'status':'error',
                          'message':msg,
                          'readonly':self.readonly,
                          'result':None}

            self.write(resultdict)
            raise tornado.web.Finish()


        # otherwise, update the checkplot list JSON
        objectid = xhtml_escape(objectid)
        changes = json.loads(changes)

        # update the dictionary
        if 'reviewed' not in self.currentproject:
            self.currentproject['reviewed'] = {}

        self.currentproject['reviewed'][objectid] = changes

        # update the JSON file
        with open(self.cplistfile,'w') as outfd:
            json.dump(self.currentproject, outfd)

        # return status
        msg = ("wrote all changes to the checkplot filelist "
               "from the frontend for object: %s" % objectid)
        LOGGER.info(msg)
        resultdict = {'status':'success',
                      'message':msg,
                      'readonly':self.readonly,
                      'result':{'objectid':objectid,
                                'changes':changes}}

        self.write(resultdict)
        self.finish()
def post(self):
        '''This handles POST requests.

        Saves the changes made by the user on the frontend back to the current
        checkplot-list.json file.

        '''

        # if self.readonly is set, then don't accept any changes
        # return immediately with a 400
        if self.readonly:

            msg = "checkplotserver is in readonly mode. no updates allowed."
            resultdict = {'status':'error',
                          'message':msg,
                          'readonly':self.readonly,
                          'result':None}

            self.write(resultdict)
            raise tornado.web.Finish()


        objectid = self.get_argument('objectid', None)
        changes = self.get_argument('changes',None)

        # if either of the above is invalid, return nothing
        if not objectid or not changes:

            msg = ("could not parse changes to the checkplot filelist "
                   "from the frontend")
            LOGGER.error(msg)
            resultdict = {'status':'error',
                          'message':msg,
                          'readonly':self.readonly,
                          'result':None}

            self.write(resultdict)
            raise tornado.web.Finish()


        # otherwise, update the checkplot list JSON
        objectid = xhtml_escape(objectid)
        changes = json.loads(changes)

        # update the dictionary
        if 'reviewed' not in self.currentproject:
            self.currentproject['reviewed'] = {}

        self.currentproject['reviewed'][objectid] = changes

        # update the JSON file
        with open(self.cplistfile,'w') as outfd:
            json.dump(self.currentproject, outfd)

        # return status
        msg = ("wrote all changes to the checkplot filelist "
               "from the frontend for object: %s" % objectid)
        LOGGER.info(msg)
        resultdict = {'status':'success',
                      'message':msg,
                      'readonly':self.readonly,
                      'result':{'objectid':objectid,
                                'changes':changes}}

        self.write(resultdict)
        self.finish()
def post ( self ) : # if self.readonly is set, then don't accept any changes # return immediately with a 400 if self . readonly : msg = "checkplotserver is in readonly mode. no updates allowed." resultdict = { 'status' : 'error' , 'message' : msg , 'readonly' : self . readonly , 'result' : None } self . write ( resultdict ) raise tornado . web . Finish ( ) objectid = self . get_argument ( 'objectid' , None ) changes = self . get_argument ( 'changes' , None ) # if either of the above is invalid, return nothing if not objectid or not changes : msg = ( "could not parse changes to the checkplot filelist " "from the frontend" ) LOGGER . error ( msg ) resultdict = { 'status' : 'error' , 'message' : msg , 'readonly' : self . readonly , 'result' : None } self . write ( resultdict ) raise tornado . web . Finish ( ) # otherwise, update the checkplot list JSON objectid = xhtml_escape ( objectid ) changes = json . loads ( changes ) # update the dictionary if 'reviewed' not in self . currentproject : self . currentproject [ 'reviewed' ] = { } self . currentproject [ 'reviewed' ] [ objectid ] = changes # update the JSON file with open ( self . cplistfile , 'w' ) as outfd : json . dump ( self . currentproject , outfd ) # return status msg = ( "wrote all changes to the checkplot filelist " "from the frontend for object: %s" % objectid ) LOGGER . info ( msg ) resultdict = { 'status' : 'success' , 'message' : msg , 'readonly' : self . readonly , 'result' : { 'objectid' : objectid , 'changes' : changes } } self . write ( resultdict ) self . finish ( )
This handles POST requests.

        Saves the changes made by the user on the frontend back to the current
        checkplot-list.json file.
This handles POST requests .