So let me tease these problems apart.

1. Some objects are not pickleable. These cannot be cached to disk.
2. If the object's class is not defined in the scope available to
gluon/cache.py, then the object cannot be unpickled.

Both of these problems can be avoided by using cache.ram. (That's what
I'm doing, and probably why Bruno's works.)

Another workaround would be for the user to pickle and unpickle
objects himself, in his own code, and then pass the string to the
cache.

We could also eliminate problem #2 by making the set of additional
class definitions available to gluon/cache.py. Perhaps with something
like "cache.set_custom_class_definitions([Blah])". This solution seems
like the shortest path... but adding new APIs like this feels
distasteful. :P

(Massimo, I'm not sure what the problem is you're referring to with
creating an instance before I cache.)

On Nov 14, 7:41 pm, Massimo Di Pierro <massimo.dipie...@gmail.com>
wrote:
> Even if they are pickable. it is possible that they get pickled but
> web2py cannot unpickle them.
>
> On Nov 14, 9:10 pm, Bruno Rocha <rochacbr...@gmail.com> wrote:
>
>
>
>
>
>
>
> > I notice that if you are planning to run on GAE, your cached object needs
> > to be Pickable, in my case, the config object instance is a king of
> > Storage, which acts like a dict.
>
> > So follow what Massimo said, and store only dict like objects in GAE,
> > otherwise you will heve this issue:
>
> > PicklingError: Can't pickle the object <foo.bar.baz>

Reply via email to