[entities] Optimize CWUser.properties.
This property gets called each time a user connects to a repository,
which means a lot.
This optimisation cuts its execution time by 5 according to my tests
--- a/entities/authobjs.py Tue Mar 04 12:41:21 2014 +0100
+++ b/entities/authobjs.py Sat Jan 03 04:06:06 2015 +0100
@@ -74,7 +74,11 @@
try:
return self._properties
except AttributeError:
- self._properties = dict((p.pkey, p.value) for p in self.reverse_for_user)
+ self._properties = dict(
+ self._cw.execute(
+ 'Any K, V WHERE P for_user U, U eid %(userid)s, '
+ 'P pkey K, P value V',
+ {'userid': self.eid}))
return self._properties
def prefered_language(self, language=None):