[entity] when .related() is called on a not-yet-saved entity, return an empty rset/list instead of raising an assertion error
--- a/entity.py Wed Jun 16 09:33:04 2010 +0200
+++ b/entity.py Wed Jun 16 09:53:17 2010 +0200
@@ -751,7 +751,10 @@
return self.related_cache(rtype, role, entities, limit)
except KeyError:
pass
- assert self.has_eid()
+ if not self.has_eid():
+ if entities:
+ return []
+ return self.empty_rset()
rql = self.related_rql(rtype, role)
rset = self._cw.execute(rql, {'x': self.eid})
self.set_related_cache(rtype, role, rset)