def delete(anIndex): if (RelativeProjectPathManager.isThereFile(Group.FILE_PATH_TO_SAVE)): groups = Group.all() for groupTuple in enumerate(groups): if (groupTuple[1].id == anIndex): groups.pop(groupTuple[0]) os.remove( RelativeProjectPathManager.getRealFilePathToSave( Group.FILE_PATH_TO_SAVE)) with open(RelativeProjectPathManager.getRealFilePathToSave( Group.FILE_PATH_TO_SAVE), 'w', encoding='UTF8') as wCSVFile: writer = csv.writer(wCSVFile, delimiter=',') for group in groups: row = [] row.append(group.id) row.append( TimeFormatter.toDatetimeString(group.period.start)) row.append(TimeFormatter.toDatetimeString( group.period.end)) row.append(group.nickName) row.append( TimeFormatter.toDatetimeString(group.savedDateTime)) writer.writerow(row) wCSVFile.close()
def save(self): if(Group.findById(self.id) is not None): Group.delete(self.id) with open(RelativeProjectPathManager.getRealFilePathToSave(Group.FILE_PATH_TO_SAVE), 'a', encoding='UTF8') as wCSVFile: writer = csv.writer(wCSVFile, delimiter=',') row = [] row.append(self.id) row.append(TimeFormatter.toDatetimeString(self.period.start)) row.append(TimeFormatter.toDatetimeString(self.period.end)) row.append(self.nickName) self.savedDateTime = datetime.now() row.append(TimeFormatter.toDatetimeString(self.savedDateTime)) writer.writerow(row) wCSVFile.close()
def save(self): if (Group.findById(self.id) is not None): Group.delete(self.id) with open(RelativeProjectPathManager.getRealFilePathToSave( Group.FILE_PATH_TO_SAVE), 'a', encoding='UTF8') as wCSVFile: writer = csv.writer(wCSVFile, delimiter=',') row = [] row.append(self.id) row.append(TimeFormatter.toDatetimeString(self.period.start)) row.append(TimeFormatter.toDatetimeString(self.period.end)) row.append(self.nickName) self.savedDateTime = datetime.now() row.append(TimeFormatter.toDatetimeString(self.savedDateTime)) writer.writerow(row) wCSVFile.close()
def delete(anIndex): if(RelativeProjectPathManager.isThereFile(Group.FILE_PATH_TO_SAVE)): groups = Group.all() for groupTuple in enumerate(groups): if(groupTuple[1].id == anIndex): groups.pop(groupTuple[0]) os.remove(RelativeProjectPathManager.getRealFilePathToSave(Group.FILE_PATH_TO_SAVE)) with open(RelativeProjectPathManager.getRealFilePathToSave(Group.FILE_PATH_TO_SAVE), 'w', encoding='UTF8') as wCSVFile: writer = csv.writer(wCSVFile, delimiter=',') for group in groups: row = [] row.append(group.id) row.append(TimeFormatter.toDatetimeString(group.period.start)) row.append(TimeFormatter.toDatetimeString(group.period.end)) row.append(group.nickName) row.append(TimeFormatter.toDatetimeString(group.savedDateTime)) writer.writerow(row) wCSVFile.close()
def __str__(self): return self.url + '\n' + self.parm + '\n' + TimeFormatter.toDatetimeString( self.createdDateTime) + '\n' + self.typeToString()
def __str__(self): return self.url + '\n' + self.parm + '\n' + TimeFormatter.toDatetimeString(self.createdDateTime) + '\n' + self.typeToString()
def getAPICallLogListGivenSessionId(aSessionId, aCaptureDatetime): response = ClassweekHttpRequester.postForDictResponse(ClassweekHttpRequester.URL_API_CALL_LOG_LIST_GIVEN_SESSION_ID, { ClassweekHttpRequester.POST_PARM_SESSION_ID : aSessionId, ClassweekHttpRequester.POST_PARM_CAPTURE_DATETIME : TimeFormatter.toDatetimeString(aCaptureDatetime)}) return response[ClassweekHttpRequester.SUCCESSFUL_RESULT_DATA_PARSING_KEY]