[rset] do not filter rsets with __getstate__, ensure whatever flies with pyro has no .req attribute, also set the ._rqlst to None since it will be reconstructed later on demand
--- a/rset.py Mon Jun 14 18:59:05 2010 +0200
+++ b/rset.py Mon Jun 14 17:56:10 2010 +0200
@@ -44,8 +44,6 @@
:type rql: str or unicode
:param rql: the original RQL query string
"""
- _picklable_attributes = set(['limited', 'rows', 'description', '_rsetactions',
- 'args', 'rowcount', '_rqlst', 'rql'])
def __init__(self, results, rql, args=None, description=(), rqlst=None):
self.rows = results
@@ -120,10 +118,6 @@
"""Returns an iterator over rows"""
return iter(self.rows)
- def __getstate__(self):
- return dict((k, v) for k, v in self.__dict__.iteritems()
- if k in self._picklable_attributes)
-
def __add__(self, rset):
# XXX buggy implementation (.rql and .args attributes at least much
# probably differ)
--- a/server/repository.py Mon Jun 14 18:59:05 2010 +0200
+++ b/server/repository.py Mon Jun 14 17:56:10 2010 +0200
@@ -350,7 +350,7 @@
pyro_unregister(self.config)
hits, misses = self.querier.cache_hit, self.querier.cache_miss
try:
- self.info('rqlt st cache hit/miss: %s/%s (%s%% hits)', hits, misses,
+ self.info('rql st cache hit/miss: %s/%s (%s%% hits)', hits, misses,
(hits * 100) / (hits + misses))
hits, misses = self.system_source.cache_hit, self.system_source.cache_miss
self.info('sql cache hit/miss: %s/%s (%s%% hits)', hits, misses,
@@ -503,9 +503,10 @@
"""return a result set containing system wide properties"""
session = self.internal_session()
try:
- return session.execute('Any K,V WHERE P is CWProperty,'
- 'P pkey K, P value V, NOT P for_user U',
- build_descr=False)
+ # don't use session.execute, we don't want rset.req set
+ return self.querier.execute(session, 'Any K,V WHERE P is CWProperty,'
+ 'P pkey K, P value V, NOT P for_user U',
+ build_descr=False)
finally:
session.close()
@@ -590,8 +591,13 @@
session = self._get_session(sessionid, setpool=True)
try:
try:
- return self.querier.execute(session, rqlstring, args,
+ rset = self.querier.execute(session, rqlstring, args,
build_descr)
+ # NOTE: the web front will (re)build it when needed
+ # e.g in facets
+ # Zeroed to avoid useless overhead with pyro
+ rset._rqlst = None
+ return rset
except (Unauthorized, RQLSyntaxError):
raise
except ValidationError, ex:
--- a/test/unittest_rset.py Mon Jun 14 18:59:05 2010 +0200
+++ b/test/unittest_rset.py Mon Jun 14 17:56:10 2010 +0200
@@ -86,6 +86,7 @@
self.assertDictEquals(params1, params2)
def test_pickle(self):
+ del self.rset.req
self.assertEquals(len(pickle.dumps(self.rset)), 392)
def test_build_url(self):