Hi, Josef Meile wrote:
some few month ago, I was trying to do the same: Store a java applet class on the file system and load it dynamically from each instance of my product, but I didn't succeeded. You can see my attempt on:
http://mail.zope.org/pipermail/zope/2004-May/149813.html
Anyway, I solved it storing the java applet on the Zope DB when initializing my product. The code is attached to the message.
Many thanks for your help. It's good to know that I'm not alone with this problem ;-) I have the following in my product constructor and it seems to work fine. It pulls in the contents of applet.jar into Zope on product instantiation. # A small dance to import the java client into Zope product_home = Globals.package_home(globals()) fname = os.path.join(product_home, 'www', 'applet.jar') f = open(fname, 'rb') filecontents = f.read() f.close() self.manage_addFile('applet.jar', filecontents, 'Applet') I borrowed the "product_home = Globals..." line from your code. Thanks! But this is not optimal because if I change applet.jar (which happens a lot during development), it is not automatically reflected within Zope. Oh well! I could call the above code whenever I modify the applet and some how hook it into product refresh. Since I have only one jar file and only a couple of product instances, my problem is manageable. But in general, how does one go about embedding arbitrary files - like html/text/pdf/etc - within products and have them automatically refreshed on Zope init/restart/etc? Like everything else in zope, I was imagining that this would be an easy/simple thing to do. Is there some reason why the Zope Gods left out such a feature? - Raja PS: The Zope XML-RPC mechanism and java xmlrpc libs from apache have simpilified my application by an order of magitude. Kudos to the Zope developers.