thnx,
I added "cacheable=True" to the select() but still the same error. On Thursday, June 20, 2013 4:23:02 PM UTC+2, Anthony wrote: > > See http://web2py.com/books/default/chapter/29/06#Caching-selects. Have > you tried: > > db(query).select(..., cacheable=True) > > Anthony > > On Thursday, June 20, 2013 10:02:44 AM UTC-4, Quint wrote: >> >> Hi, >> >> I am using GAE (dev server) and i am unable to cache Row objects. >> For some reason they cannot be pickled. >> When a convert it to dicts everything works fine, but then i am unable to >> work with web2py Rows. >> >> This is a related post: >> https://groups.google.com/forum/#!msg/web2py/SbJGKMRyeT8/BNybB-znFQgJ >> >> I tried 2 different ways and below i copied the errors. The first is when >> using my own caching mechanism in which i pickle the data myself and >> directly use GAE memcache. >> The second is when i use "@cache.action" >> * >> * >> *Pickle by me* >> ========= >> >> Traceback (most recent call last): >> >> File "C:\Users\****************\gluon\restricted.py", line 212, in >> restricted >> exec ccode in environment >> File "C:\Users\****************\applications\init\controllers/api.py", >> line 401, in <module> >> File "C:\Users\****************\gluon\globals.py", line 194, in <lambda> >> self._caller = lambda f: f() >> File "C:\Users\****************\gluon\globals.py", line 158, in f >> return rest_action(*_self.args, **_self.vars) >> File "C:\Users\****************\applications\init\controllers/api.py", >> line 346, in GET >> return get(get_articles, use_etag, t, categories=c, channel=ch) >> File "C:\Users\****************\applications\init\controllers/api.py", >> line 259, in get >> cached_response = pickle.dumps(cached_response) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 1374, in dumps >> Pickler(file, protocol).dump(obj) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 224, in dump >> self.save(obj) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 331, in save >> self.save_reduce(obj=obj, *rv) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 401, in save_reduce >> save(args) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 286, in save >> f(self, obj) # Call unbound method with explicit self >> File "C:\Python\Python273_X86\Lib\pickle.py", line 562, in save_tuple >> save(element) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 286, in save >> f(self, obj) # Call unbound method with explicit self >> File "C:\Python\Python273_X86\Lib\pickle.py", line 649, in save_dict >> self._batch_setitems(obj.iteritems()) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 663, in _batch_setitems >> save(v) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 286, in save >> f(self, obj) # Call unbound method with explicit self >> File "C:\Python\Python273_X86\Lib\pickle.py", line 649, in save_dict >> self._batch_setitems(obj.iteritems()) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 663, in _batch_setitems >> save(v) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 286, in save >> f(self, obj) # Call unbound method with explicit self >> File "C:\Python\Python273_X86\Lib\pickle.py", line 600, in save_list >> self._batch_appends(iter(obj)) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 615, in _batch_appends >> save(x) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 331, in save >> self.save_reduce(obj=obj, *rv) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 419, in save_reduce >> save(state) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 286, in save >> f(self, obj) # Call unbound method with explicit self >> File "C:\Python\Python273_X86\Lib\pickle.py", line 649, in save_dict >> self._batch_setitems(obj.iteritems()) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 663, in _batch_setitems >> save(v) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 331, in save >> self.save_reduce(obj=obj, *rv) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 401, in save_reduce >> save(args) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 286, in save >> f(self, obj) # Call unbound method with explicit self >> File "C:\Python\Python273_X86\Lib\pickle.py", line 562, in save_tuple >> save(element) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 300, in save >> self.save_global(obj) >> File "C:\Python\Python273_X86\Lib\pickle.py", line 748, in save_global >> (obj, module, name)) >> PicklingError: Can't pickle <class 'gluon.dal.article'>: it's not found >> as gluon.dal.article >> >> >> *@cache.action* >> =========== >> >> Traceback (most recent call last): >> File "C:\Users\****************\gluon\restricted.py", line 212, in >> restricted >> exec ccode in environment >> File "C:\Users\****************\applications\init\controllers/api.py", >> line 403, in <module> >> File "C:\Users\****************\gluon\globals.py", line 194, in <lambda> >> self._caller = lambda f: f() >> File "C:\Users\****************\gluon\cache.py", line 505, in wrapped_f >> rtn = cache_model(cache_key, lambda : func(), time_expire=time_expire) >> File "C:\Users\****************\gluon\contrib\gae_memcache.py", line 40, >> in __call__ >> self.client.set(key, (time.time(), value)) >> File "C:\Program Files >> (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", >> line 773, in set >> namespace=namespace) >> File "C:\Program Files >> (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", >> line 878, in _set_with_policy >> time, '', namespace) >> File "C:\Program Files >> (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", >> line 957, in _set_multi_async_with_policy >> stored_value, flags = _validate_encode_value(value, self._do_pickle) >> File "C:\Program Files >> (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", >> line 227, in _validate_encode_value >> stored_value = do_pickle(value) >> File "C:\Program Files >> (x86)\Google\google_appengine\google\appengine\api\memcache\__init__.py", >> line 399, in _do_pickle >> pickler.dump(value) >> TypeError: 'NoneType' object is not callable >> >> >> Does anyone know whats going on here? >> >> Thanks! >> > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.