|
From: <bc...@wo...> - 2001-02-27 13:03:47
|
[brian] >The method Py.java2py does not support all clases and is closed to the end >user. I would like to add functionality for classes such as BigDecimal to >have Python wrappers, but don't want to endlessly patch the core. Has there >been any effort to make this a bit more extensible? > >I wrote a patch for JPython (since lost when I switched jobs) that allowed >me to use a properties file to map a Java class to a Python wrapper. This >allowed me to wrap a Money object and to have it perform all the magic >methods. > >I would be willingly to write the patch again since I would like some of >this functionality but didn't want to work on something that perhaps someone >has already started. If no one has started, are there any ideas floating >around, such as adding it to the registry the way the modules are loaded by >first looking at "python.modules.builtin". I can't remember anyone asking for this. A feature request that resembles the java2py wrappers are ProxyCollection creations. http://mail.python.org/pipermail/jpython-dev/2000-February/000022.html http://mail.python.org/pipermail/jpython-dev/2000-March/000023.html A possible problem with most such class->handler mappings are the lack of inheritance support. F.ex subclasses of BigDecimal should, by default, be handled by the same wrapper as BigDecimal. In addition to registry support, there should also be support for adding additinal wrapper (and proxy) classes through an python API. >Finally, if we do add such functionality, should we have as the ant project >does an optional jar which contains Python-wrapped Java objects, for example >PySession and PyRequest, that would be outside of the core? Not sure. I think the additional wrappers will be outside the core by definition. I don't believe that jython should search for a optional.jar and include it if found. IMO that is better done by the author by including her optional.jar on the classpath. regards, finn |