|
From: Chris K. <ck...@ma...> - 2000-11-28 14:50:31
|
Finn Bock: > >All, I would like to use PyLists and PyDictionaries > interchangably between > >Java and Jython. > > The real problem with this approach is java1 compatibility. It is an > unmoving requirement that jython can be used in a java1 browser like IE. > So all uses of java2 features must be wrapped in a separate class. See > CollectionProxy2.java and Java2Accessibility.java for example on how > this can be done. Gah, you're correct...My biggest problem is I'm constructing Py classes in Java and sometimes wanting to pass them to Python and sometimes wanting to pass them to other Java methods that are expecting Maps or Lists. (Actually, I wonder if the Map and Collection interfaces would compile in Java 1.1? They're fairly simplistic. I don't really need the functionality in 1.1 but I don't want to break Jython.) > >Also, one other thing of note: I've been trying to execute CGI scripts > >under the Servlet architecture without having to make code mods to the > >Python script (or at least making minimal changes.) As such, I've > >implemented a cgi.FieldStorage class in Java that acts like the CPython > >equivalent, as well as a Java class equivalent for Cookie.SimpleCookie. > > Couldn't these classes also be created as python modules? Eh, I went that route for a while and found it to be a pain in the arse, in particular, when you need to send the cookie information back to the client, you'd have to traverse through the Jython objects, calling methods along the way to properly format the cookie data. (It's not just a matter of doing "str(cookies)", since they have to be mapped into the addCookie() method.) I also ran into some weird incompatability problems with the SmartCookie classes, since JPython mis-identified an e-mail address cookie as a serialized object and tried to deserialize it. |