Esempio n. 1
0
	def lastModifiedTimeMs(self):
		"""
		Returns the last modified time of this Blip in milliseconds since
		the epoc.
		
		"""
		return datetime2milliseconds(self.last_modified)
Esempio n. 2
0
	def timestampMs(self):
		"""
		Returns the timestamp of this Delta in milliseconds since
		the epoc.
		
		"""
		return datetime2milliseconds(self.timestamp)
Esempio n. 3
0
	def creationTimeMs(self):
		"""
		Returns the time of creation of this Blip in milliseconds since
		the epoc.
		
		"""
		return datetime2milliseconds(self.created)
Esempio n. 4
0
	def serialize(self):
		"""
		Serialize the wavelet into a format that is compatible with robots and
		the client.
		
		"""
		return {
			"rootBlipId": getattr(self.root_blip, "id", None),
			"title": self.title,
			"creator": self.creator.id,
			"creationTime": datetime2milliseconds(self.created),
			"dataDocuments": None, #TODO (is not declared in the robot protocol example)
			"waveletId": self.id,
			"participants": map(lambda p: p.id, self.participants.all()),
			"version": self.version,
			"lastModifiedTime": datetime2milliseconds(self.last_modified),
			"waveId": self.wave.id,
		}
Esempio n. 5
0
	def serialize(self):
		"""
		Serialize the blip into a format that is compatible with robots and the
		client.
		
		"""
		return {
			"blipId": self.id,
			"content": self.text,
			"elements": map(lambda e: e.serialize(), self.elements.all()),
			"contributors": map(lambda p: p.id, self.contributors.all()),
			"creator": self.creator.id,
			"parentBlipId": getattr(self.parent, "id", None),
			"annotations": map(lambda a: a.serialize(), self.annotations.all()),
			"waveletId": self.wavelet.id,
			"version": self.version,
			"lastModifiedTime": datetime2milliseconds(self.last_modified),
			"childBlipIds": map(lambda c: c.id, self.children.all()),
			"waveId": self.wavelet.wave.id,
			"submitted": bool(self.submitted),
			"checksum": self.checksum() # Note: This is tentative and subject to change
		}