def __init__(self, id, defaultSprintTab, defaultTasksTab, backlogStyles, messages): ActiveRecord.__init__(self) self.id = id # Same as the parent user's ID self.defaultSprintTab = defaultSprintTab self.defaultTasksTab = defaultTasksTab self.backlogStyles = backlogStyles self.messages = messages
def __init__(self, taskid, userid, body, timestamp = None, id = None): ActiveRecord.__init__(self) self.id = id self.taskid = taskid self.userid = userid self.body = body self.timestamp = timestamp or dateToTs(getNow())
def __init__(self, sprintid, name, seq = None, deletable = True, id = None): ActiveRecord.__init__(self) self.id = id self.sprintid = sprintid self.name = name self.seq = seq if seq else maxOr(group.seq for group in self.sprint.getGroups()) + 1 self.deletable = to_bool(deletable)
def __init__(self, userid, name, query, public, followerids = None, id = None): ActiveRecord.__init__(self) self.id = id self.userid = userid self.name = name self.query = query self.public = public self.followerids = followerids or set()
def __init__(self, projectid, name, ownerid, start, end, memberids = None, flags = None, id = None): ActiveRecord.__init__(self) self.id = id self.projectid = projectid self.name = name self.ownerid = ownerid self.start = start self.end = end self.memberids = memberids or set() self.flags = flags or set()
def __init__(self, userid, senderid, title, body, language = 'html', timestamp = None, read = False, id = None): ActiveRecord.__init__(self) self.id = id self.userid = userid self.senderid = senderid self.title = title self.body = body self.language = language self.timestamp = timestamp or dateToTs(getNow()) self.read = read
def __init__(self, groupid, sprintid, creatorid, goalid, name, status, hours, assignedids = None, seq = None, timestamp = None, deleted = False, revision = 1, id = None): ActiveRecord.__init__(self) self.id = id self.revision = revision self.groupid = groupid self.sprintid = sprintid self.creatorid = creatorid self.goalid = goalid self.name = name self.status = status self.hours = hours self.assignedids = assignedids or set() self.timestamp = timestamp if timestamp else max(dateToTs(getNow()), self.sprint.start) self.seq = seq if seq else maxOr(task.seq for task in self.group.getTasks())+1 self.deleted = deleted
def delete(self, deep = True): if deep: for name in ['Goal', 'Group', 'Task']: cls = getattr(import_module(name, name), name) cls.deleteAll(sprintid = self.id) from Availability import Availability Availability(self).wipe() return ActiveRecord.delete(self)
def save(self): if not self.id: # Shift everything after this sequence for id, group in db()['groups'].iteritems(): if group['sprintid'] == self.sprintid and group['seq'] >= self.seq: with db()['groups'].change(id) as data: data['seq'] += 1 return ActiveRecord.save(self)
def __init__(self, type, text, userid = None, ip = None, timestamp = None, location = 0, id = None): ActiveRecord.__init__(self) self.id = id self.userid = userid self.ip = ip self.type = type self.text = text if timestamp: self.timestamp = timestamp else: now = datetime.now() # Use real time, not mocked time through getNow() self.timestamp = dateToTs(now) + now.microsecond / 1000000 if isinstance(location, int): filename, line, fn, code = traceback.extract_stack()[-2-location] if filename.startswith(basePath()): filename = filename[len(basePath())+1:] self.location = "%s(%s:%d)" % (fn, filename, line) else: self.location = location
def save(self): #DEBUG #NO if not isinstance(self.assignedids, (set, frozenset)): raise RuntimeError("Broken type (%s)" % type(self.assignedids).__name__) if not isinstance(self.assigned, (set, frozenset)): raise RuntimeError("Broken type (%s)" % type(self.assigned).__name__) if not self.id: # Shift everything after this sequence for id, task in db()['tasks'].iteritems(): rev = task[-1] if rev['groupid'] == self.groupid and rev['seq'] >= self.seq: with db()['tasks'].change(id) as data: data[-1]['seq'] += 1 return ActiveRecord.save(self)
def __init__(self, changeid, userid, timestamp = None, id = None): ActiveRecord.__init__(self) self.id = id self.changeid = changeid self.userid = userid self.timestamp = timestamp if timestamp else dateToTs(getNow())
def __init__(self, catid, body, good, id = None): ActiveRecord.__init__(self) self.id = id self.catid = catid self.body = body self.good = good
def __init__(self, sprintid, name, id = None): ActiveRecord.__init__(self) self.id = id self.sprintid = sprintid self.name = name
def delete(self): self.move(None) return ActiveRecord.delete(self)
def save(self): if not isinstance(self.followerids, (set, frozenset)): raise RuntimeError("Broken type (%s)" % type(self.followerids).__name__) if not isinstance(self.followers, (set, frozenset)): raise RuntimeError("Broken type (%s)" % type(self.followers).__name__) return ActiveRecord.save(self)