def edit(cls, uuid): data = connection.get('/project/%s/edit' % (uuid)) if not data: details = Project.get(uuid, as_json=True) data = dump_to_json(details) connection.set('/project/%s/edit' % (uuid), data) else: details = json.loads(data) project = cls(details) project.edit = True return project
def save(self): uuid = self._uuid timestamp = str(uuid1()) self._details['_uuid'] = uuid self._details['_timestamp'] = timestamp data = dump_to_json(self._details) if self.edit: connection.set('/project/%s/edit' % (uuid), data) else: connection.sadd('/project', uuid) connection.sadd('/project/%s' % (uuid), timestamp) connection.set('/project/%s/%s' % (uuid, timestamp), data)