<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Dec 2, 2013, at 11:45 AM, Daniel Sank <<a href="mailto:sank.daniel@gmail.com">sank.daniel@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><blockquote type="cite">One way to fix this is to manually construct a ViewPoint rather than a Viewable and pass that to the client.<br></blockquote><br>For the sake of trying to get my current project to work and so that I<br>can understand what's really going on and fix the bugs in pb: how<br>would I do the similar thing for a Cacheable? Looking at the source so<br>far I'm having trouble figuring out where things like Viewable come<br>into play.</blockquote><div><br></div>This isn't quite as clean as with ViewPoint, but it's not all that bad either.  Basically, you need to inject the correct perspective into the RemoteCacheObserver which is constructed; unfortunately it reads it only from the jellier.</div><div><br></div><div>So: fix the jellier :-).</div><div><br></div><div>So something like this might do the trick:</div><div><br></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;"><div>class Perspectiveize(Jellyable):</div><div>    def __init__(self, perspective, obj):</div><div>        self.perspective = perspective</div><div>        self.obj = obj</div><div>    def jellyFor(self, jellier):</div><div>        old = jellier.invoker.serializingPerspective</div><div>        jellier.invoker.serializingPerspective = self.perspective</div><div>        try:</div><div>            return self.obj.jellyFor(jellier)</div><div>        finally:</div><div>            jellier.invoker.serializingPerspective = old</div></blockquote><div><br></div><div>Untested, but I think it should do the trick.  One caveat though; if the 'obj' (in your case, Cacheable) that you wrap with this is serialized twice within the same top-level call to 'jelly', (i.e. if there are multiple references to it from within a single return message or remote method call) the second time it is serialized, it will simply serialize a reference to the first; this means you have to be careful to be sure that the Perspectiveize object is serialized before the Cacheable itself if the Cacheable is to be serialized at all.</div><div><br></div><div>Good luck,</div><div><br></div><div>-glyph</div><div><br></div></body></html>