def reset(): print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC) try: shutil.rmtree(ticketsPath) os.makedirs(ticketsPath) except OSError: os.makedirs(ticketsPath) quickAccess.unload(listFile, [])
def remove(id): print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC) tickets = quickAccess.load(listFile) ticket = getById(id) tickets.remove(ticket) quickAccess.unload(listFile, tickets) print '%sreturn: %s%s' % (settings.color.YELLOW, ticket, settings.color.ENDC) return ticket
def remove(ticketId): print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC) comments = quickAccess.load(listFile) comment = getByTicketId(ticketId) comments.remove(comment) quickAccess.unload(listFile, comments) print '%sreturn: %s%s' % (settings.color.YELLOW, comment, settings.color.ENDC) return comment
def remove(ticketId): print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC) descriptions = quickAccess.load(listFile) description = getByTicketId(ticketId) descriptions.remove(description) quickAccess.unload(listFile, descriptions) print '%sreturn: %s%s' % (settings.color.YELLOW, description, settings.color.ENDC) return description
def create(ticketId, comment): print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC) comments = quickAccess.load(listFile) timestamp = settings.timestamp() comment = [ticketId, comment, timestamp] comments.append(comment) quickAccess.unload(listFile, comments) print '%sreturn: %s%s' % (settings.color.YELLOW, comment, settings.color.ENDC) return comment
def create(ticketId, description): print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC) descriptions = quickAccess.load(listFile) timestamp = settings.timestamp() description = [ticketId, description, timestamp] descriptions.append(description) quickAccess.unload(listFile, descriptions) print '%sreturn: %s%s' % (settings.color.YELLOW, description, settings.color.ENDC) return description
def create(username, password): print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC) users = quickAccess.load(listFile) userId = len(users) timestamp = settings.timestamp() password = encryptor.hashPassword(password) userId = str(userId) user = [userId, username, password, timestamp] users.append(user) quickAccess.unload(listFile, users) userFile = '%s/%s.json' % (usersPath, userId) quickAccess.unload(userFile, []) print '%sreturn: %s%s' % (settings.color.YELLOW, user, settings.color.ENDC) return user
def create(id, status, author): print "%s%s %s%s" % (settings.color.RED, __name__, inspect.stack()[0][3], settings.color.ENDC) tickets = quickAccess.load(listFile) timestamp = settings.timestamp() signature = random.random() ticket = [timestamp, id, signature, status, author] tickets.append(ticket) quickAccess.unload(listFile, tickets) userFile = '%s/%s.json' % (usersPath, author) tickets = quickAccess.load(userFile) tickets.append(ticket) quickAccess.unload(userFile, tickets) print '%sreturn: %s%s' % (settings.color.YELLOW, ticket, settings.color.ENDC) logsModule.createEntry(ticket) return ticket