def UpdateStatus(self,directory,files,status,service):
<EOL>dfiles,db=self.GetStatus(directory,files)<EOL>if not files and status==self.ST_UPTODATE:<EOL><INDENT>files=[]<EOL>logger.debug('<STR_LIT>')<EOL>for fn in dfiles:<EOL><INDENT>if dfiles[fn]['<STR_LIT:status>']==self.ST_ADDEDor dfiles[fn]['<STR_LIT:status>']==self.ST_MODIFIEDor dfiles[fn]['<STR_LIT:status>']==self.ST_COMPLICATEDor dfiles[fn]['<STR_LIT:status>']==self.ST_DELETED:<EOL><INDENT>files.append(fn)<EOL>logger.debug('<STR_LIT>'%(fn,dfiles[fn]['<STR_LIT:status>']))<EOL><DEDENT><DEDENT><DEDENT>files_that_exist=[]<EOL>for fn in files:<EOL><INDENT>if fn in dfiles:<EOL><INDENT>files_that_exist.append(fn)<EOL><DEDENT>else:<EOL><INDENT>logger.debug("<STR_LIT>"%(fn))<EOL><DEDENT><DEDENT>files_that_exist.sort()<EOL>if service is None or service is '<STR_LIT>':<EOL><INDENT>sobj=self.sman.GetServiceObj('<STR_LIT>')<EOL>files_hack_media=[]<EOL>files_hack_config=[]<EOL>files_hack_other=[]<EOL>for filename in files_that_exist:<EOL><INDENT>if sobj._isMediaFile(filename):<EOL><INDENT>files_hack_media.append(filename)<EOL><DEDENT>elif sobj._isConfigFile(filename):<EOL><INDENT>files_hack_config.append(filename)<EOL><DEDENT>else:<EOL><INDENT>files_hack_other.append(filename)<EOL><DEDENT><DEDENT>files_that_exist=[]<EOL>files_that_exist.append(files_hack_media)<EOL>files_that_exist.append(files_hack_config)<EOL>files_that_exist.append(files_hack_other)<EOL>files_that_exist=list(chain.from_iterable(files_that_exist))<EOL><DEDENT>for fn in files_that_exist:<EOL><INDENT>if status==self.ST_ADDED:<EOL><INDENT>self._updateToAdded(directory,fn,dfiles[fn],db,service)<EOL><DEDENT>elif status==self.ST_UPTODATE:<EOL><INDENT>if not db.has_key(fn):<EOL><INDENT>print("<STR_LIT>"%(fn))<EOL>continue<EOL><DEDENT>if service:<EOL><INDENT>servicelist=[service]<EOL><DEDENT>else:<EOL><INDENT>servicelist=db[fn]['<STR_LIT>'].keys()<EOL><DEDENT>for sn in servicelist:<EOL><INDENT>if not db[fn]['<STR_LIT>'].has_key(sn):<EOL><INDENT>print("<STR_LIT>"%(fn,sn))<EOL>continue<EOL><DEDENT>if db[fn]['<STR_LIT>'][sn]['<STR_LIT:status>']==self.ST_DELETED:<EOL><INDENT>self._deleteFile(directory,fn,dfiles[fn],db,sn)<EOL><DEDENT>else:<EOL><INDENT>self._uploadFile(directory,fn,dfiles[fn],db,sn)<EOL><DEDENT><DEDENT><DEDENT>elif status==self.ST_DELETED:<EOL><INDENT>self._updateToDeleted(directory,fn,dfiles[fn],db,service)<EOL><DEDENT>self._saveDB(directory,db)<EOL><DEDENT>self._saveDB(directory,db)<EOL>self.PrintStatus(directory,files)<EOL>
Given a list of files in a certain directory,
        updates to the given status
        If status is ST_UPTODATE, and no files given
        will go through current DB and push files
        with the "A" flag
        service: If none, assumes all services, looks for matching service