|
|
@@ -70,7 +70,10 @@ class DbMixin:
|
|
|
# The cache is updated a first time so that instances looking up
|
|
|
# for this instance during the load_reverse can find it
|
|
|
kls.cache[key] = instance
|
|
|
- instance.id = document.doc_id
|
|
|
+ try:
|
|
|
+ instance.id = document.doc_id
|
|
|
+ except AttributeError:
|
|
|
+ ...
|
|
|
instance.load_reverse()
|
|
|
# The cache value is updated with its final value
|
|
|
kls.cache[key] = instance
|
|
|
@@ -86,4 +89,5 @@ class DbMixin:
|
|
|
|
|
|
def save(self):
|
|
|
self.document.update({'uuid': str(uuid.uuid4())})
|
|
|
- db.table(self.class_name()).insert(self.document)
|
|
|
+ self.id = db.table(self.class_name()).insert(self.document)
|
|
|
+ self.cache[self._get_cache_key(self.document)] = self
|