예제 #1
0
    def openFiles(self,
                  conffile=myConstants.CONFIG_FILE,
                  seriefile=myConstants.SERIES_FILE):
        # conf file opening
        logging.info('OpenFile ' + str(conffile) + ' and ' + str(seriefile))
        try:
            self.confData = jsonConfigParser.jsonConfigValue(self.confschema,
                                                             value=None,
                                                             filename=conffile)
        except Exception as e:
            logging.info('Fail to open file:' + str(conffile))
            logging.debug(str(e))
            return {
                'rtn': '401',
                'tracker_conf': self.get_tracker_conf(),
                'error': messages.returnCode['401'].format(conffile)
            }
        self.confFilename = conffile

        # conf file parsing
        self.confData.load()
        try:
            self.confData.load()
        except Exception as e:
            logging.info('Fail to parse file:' + str(conffile))
            logging.debug(str(e))
            return {
                'rtn': '423',
                'tracker_conf': self.get_tracker_conf(),
                'error': messages.returnCode['423'].format(conffile)
            }

        logging.info('Conf file OK, opening Serie List')
        return self.seriefile.openFile(seriefile)
예제 #2
0
	def createConf(self,filename,conf={}):
		logging.info('CreateConf ' + str(filename) + ' with '+ str(conf))
		if (not self.getAuth()):
			return {'rtn':'406','error':messages.returnCode['406']}
		confData = {"version":myConstants.CONFIG_VERSION}
		confData.update(conf)
		self.confFilename = filename
		try:
			self.confData = jsonConfigParser.jsonConfigValue(self.confschema,value=None,filename=filename)
		except:
			return {'rtn':'424','error':messages.returnCode['424'].format(filename)}
		return {'rtn':'200','error':messages.returnCode['200']}
예제 #3
0
 def createConf(self, filename, conf={}):
     logging.info('CreateConf ' + str(filename) + ' with ' + str(conf))
     if (not self.getAuth()):
         return {'rtn': '406', 'error': messages.returnCode['406']}
     confData = {"version": myConstants.CONFIG_VERSION}
     confData.update(conf)
     self.confFilename = filename
     try:
         self.confData = jsonConfigParser.jsonConfigValue(self.confschema,
                                                          value=None,
                                                          filename=filename)
     except:
         return {
             'rtn': '424',
             'error': messages.returnCode['424'].format(filename)
         }
     return {'rtn': '200', 'error': messages.returnCode['200']}
예제 #4
0
	def openFiles(self,conffile=myConstants.CONFIG_FILE,seriefile=myConstants.SERIES_FILE):
		# conf file opening
		logging.info('OpenFile ' + str(conffile) + ' and '+ str(seriefile))
		try:
			self.confData = jsonConfigParser.jsonConfigValue(self.confschema,value=None,filename=conffile)
		except Exception as e:
			logging.info('Fail to open file:'+ str(conffile))
			logging.debug(str(e))
			return {'rtn':'401','tracker_conf':self.get_tracker_conf(),'error':messages.returnCode['401'].format(conffile)}
		self.confFilename = conffile
		
		# conf file parsing
		self.confData.load()
		try:
			self.confData.load()
		except Exception as e:
			logging.info('Fail to parse file:'+ str(conffile))
			logging.debug(str(e))
			return {'rtn':'423','tracker_conf':self.get_tracker_conf(),'error':messages.returnCode['423'].format(conffile)}
		
		logging.info('Conf file OK, opening Serie List')
		return self.seriefile.openFile(seriefile)