We had to subclass the Server to get it to pass class instances around. Something like this:

---------------------------------------------------------------
from Webware.MiscUtils.PickleRPC import Server, Transport

class OurServer(Server):
       def __init__(self, uri):
               Server.__init__( self, uri, MyTransport() )


class MyTransport(Transport):


def allowedGlobals(self):
return [ ('AssMan.FileTypes', 'BogusFile'), ('AssMan.FileTypes', 'JPGFile') ]


def findGlobal(self, module, klass):
if (module, klass) not in self.allowedGlobals():
raise UnpicklingError, 'For security reasons, you can\'t unpickle objects fr
om module %s with type %s' % (module, klass)
globals = {}
exec 'from %s import %s as theClass' % (module, klass) in globals
return globals['theClass']
---------------------------------------------------------------


We have since moved on to just getting the data payload from the classes rather than the classes themselves, and we feel better about that.

Stephen Semeniuk wrote:

Hello. I'm playing around with Webware 0.8.1, specifically PickleRPCServlet, and I've developed a nasty bruise on my head from banging it against the wall. Specifically, I'm trying to override the allowedGlobals() method in my servlet, but PickleRPC doesn't seem to see my list.




------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. SourceForge.net hosts over 70,000 Open Source Projects. See the people who have HELPED US provide better services: Click here: http://sourceforge.net/supporters.php _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to