Example #1
0
 def changedp(self):
     if self.rcodehash is None:
         return False
     cmp = copy.deepcopy(self.to_json())
     cmp['rid'] = cmp['rid'].split(":")[1]
     calced = datahash.datahash(cmp)
     return self.rcodehash != calced
Example #2
0
 def changedp(self):
     if self.rcodehash is None:
         return False
     cmp = copy.deepcopy(self.to_json())
     cmp['rid'] = cmp['rid'].split(":")[1]
     calced = datahash.datahash(cmp)
     return self.rcodehash != calced
Example #3
0
 def to_json(self):
     when = FullPattern(
         self.meta.when) if self.meta.specified('when') else ''
     rcode = "%s%d%2.2d%2.2d%2.2d%2.2d" % \
         ('Y' if self._merged else 'X',self.dt.day,self.dt.start[0],self.dt.start[1],self.dt.end[0],self.dt.end[1])
     out = {
         "day": self.dt.day,
         "starttime": self.dt.start,
         "endtime": self.dt.end,
         "cid": self._course.cid,
         "rid": rcode,
         "text": self.text if self.text is not None else self.meta.what,
         "cname": self._course.cname,
         "what": self.meta.what,
         "organiser": self.meta.who,
         "where": self.meta.where,
         "type": self.type,
         "termweeks": self._termweeks,
         "code": self.key,
         "when": str(when)
     }
     rcodehash = datahash.datahash(out)
     out['rid'] = "%s:%s:%s" % (rcodehash, out['rid'], util.rndid(
         rcode, "R"))
     return out
Example #4
0
 def to_json(self):
     rects = []
     for z in self.zoos.itervalues():
         rects.extend(z.to_json())
     out = {'id': self.id, 'rectangles': rects, 'courses': self.courses}
     out['vhash'] = datahash.datahash(out)
     return out
Example #5
0
 def to_json(self):
     rects = []
     for z in self.zoos.itervalues():
         rects.extend(z.to_json())
     out = {
         'id': self.id,
         'rectangles': rects,
         'courses': self.courses
     }
     out['vhash'] = datahash.datahash(out)
     return out
Example #6
0
 def to_json(self,quick = False):
     out =  {
         'id': self.id,
         'name': self.name,
         'organiser': self.who,
         'where': self._where,
         "metadata": self._metadata,
         'groups': []
     }
     groups = sorted(self._groups.values(),key = lambda x: x.key())
     for g in groups:
         out['groups'].append(g.to_json(quick))
     out['vhash'] = datahash.datahash(out)
     return out
Example #7
0
 def to_json(self):
     when = FullPattern(self.meta.when) if self.meta.specified('when') else ''
     rcode = "%s%d%2.2d%2.2d%2.2d%2.2d" % \
         ('Y' if self._merged else 'X',self.dt.day,self.dt.start[0],self.dt.start[1],self.dt.end[0],self.dt.end[1])
     out = {
         "day": self.dt.day,
         "starttime": self.dt.start,
         "endtime": self.dt.end,
         "cid": self._course.cid,
         "rid": rcode,
         "text": self.text if self.text is not None else self.meta.what,
         "cname": self._course.cname,
         "what": self.meta.what,
         "organiser": self.meta.who,
         "where": self.meta.where,
         "type": self.type,
         "termweeks": self._termweeks,
         "code": self.key,
         "when": str(when)
     }
     rcodehash = datahash.datahash(out)
     out['rid'] = "%s:%s:%s" % (rcodehash,out['rid'],util.rndid(rcode,"R"))
     return out