[Twisted-Python] grokking cacheable, take 2
Bruce Mitchener
bruce at cubik.org
Thu Nov 7 08:11:11 MST 2002
car,
carball at hush.com wrote:
> ok, the insecurejelly error i was getting i found was actually
> due to trying to store the observer(s) in the Cacheable object itself. .
>
> evidently jelly doesnt take too kindly to having these objects
> in there when it serializes the Cacheable. .
>
> i was able to get around this by storing the observer in the perspective
> that is passed as the first argument to getStateToCacheAndObserveFor
>
> the docs say storing the observer(s) in the Cacheable is the preferred method no?
>
> "It is recommended that your object maintain a list (note: library support for this is forthcoming!) of observers, and update them using callRemote when the Cacheable changes in a way that should be noticeable to its clients."
>
> so, my new question is: what IS the preferred way to store observers?
> -------------------------
> i have a feeling the answer was in the first round of responses i got
> ( greatly appreciated, thank you ), but i still do not entirely understand what the best method would be. .
I store the observers on my cacheable and then override
getStateToCacheAndObserveFor to specificly enumerate and transform the
data that I want handled, rather than rely upon the default
implementation which just returns self.__dict__.
- Bruce
More information about the Twisted-Python
mailing list