You can subscribe to this list here.
2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(107) |
Dec
(67) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(76) |
Feb
(125) |
Mar
(72) |
Apr
(13) |
May
(18) |
Jun
(12) |
Jul
(129) |
Aug
(47) |
Sep
(1) |
Oct
(36) |
Nov
(128) |
Dec
(124) |
2002 |
Jan
(59) |
Feb
|
Mar
(14) |
Apr
(14) |
May
(72) |
Jun
(9) |
Jul
(3) |
Aug
(5) |
Sep
(18) |
Oct
(65) |
Nov
(28) |
Dec
(12) |
2003 |
Jan
(10) |
Feb
(2) |
Mar
(4) |
Apr
(33) |
May
(21) |
Jun
(9) |
Jul
(29) |
Aug
(34) |
Sep
(4) |
Oct
(8) |
Nov
(15) |
Dec
(4) |
2004 |
Jan
(26) |
Feb
(12) |
Mar
(11) |
Apr
(9) |
May
(7) |
Jun
|
Jul
(5) |
Aug
|
Sep
(3) |
Oct
(7) |
Nov
(1) |
Dec
(10) |
2005 |
Jan
(2) |
Feb
(72) |
Mar
(16) |
Apr
(39) |
May
(48) |
Jun
(97) |
Jul
(57) |
Aug
(13) |
Sep
(16) |
Oct
(24) |
Nov
(100) |
Dec
(24) |
2006 |
Jan
(15) |
Feb
(34) |
Mar
(33) |
Apr
(31) |
May
(79) |
Jun
(64) |
Jul
(41) |
Aug
(64) |
Sep
(31) |
Oct
(46) |
Nov
(55) |
Dec
(37) |
2007 |
Jan
(32) |
Feb
(61) |
Mar
(11) |
Apr
(58) |
May
(46) |
Jun
(30) |
Jul
(94) |
Aug
(93) |
Sep
(86) |
Oct
(69) |
Nov
(125) |
Dec
(177) |
2008 |
Jan
(169) |
Feb
(97) |
Mar
(74) |
Apr
(113) |
May
(120) |
Jun
(334) |
Jul
(215) |
Aug
(237) |
Sep
(72) |
Oct
(189) |
Nov
(126) |
Dec
(160) |
2009 |
Jan
(180) |
Feb
(45) |
Mar
(98) |
Apr
(140) |
May
(151) |
Jun
(71) |
Jul
(107) |
Aug
(119) |
Sep
(73) |
Oct
(121) |
Nov
(14) |
Dec
(6) |
2010 |
Jan
(13) |
Feb
(9) |
Mar
(10) |
Apr
(64) |
May
(3) |
Jun
(16) |
Jul
(7) |
Aug
(23) |
Sep
(17) |
Oct
(37) |
Nov
(5) |
Dec
(8) |
2011 |
Jan
(10) |
Feb
(11) |
Mar
(77) |
Apr
(11) |
May
(2) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <fwi...@us...> - 2009-03-10 19:30:38
|
Revision: 6092 http://jython.svn.sourceforge.net/jython/?rev=6092&view=rev Author: fwierzbicki Date: 2009-03-10 19:30:29 +0000 (Tue, 10 Mar 2009) Log Message: ----------- Try again, tagging beta 3 Added Paths: ----------- tags/Release_2_5beta3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-10 19:29:54
|
Revision: 6091 http://jython.svn.sourceforge.net/jython/?rev=6091&view=rev Author: fwierzbicki Date: 2009-03-10 19:29:43 +0000 (Tue, 10 Mar 2009) Log Message: ----------- spelling error, so untagging. Removed Paths: ------------- tags/Release_2_5beta3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-10 19:29:09
|
Revision: 6090 http://jython.svn.sourceforge.net/jython/?rev=6090&view=rev Author: fwierzbicki Date: 2009-03-10 19:28:52 +0000 (Tue, 10 Mar 2009) Log Message: ----------- spelling error. Modified Paths: -------------- trunk/jython/README.txt Modified: trunk/jython/README.txt =================================================================== --- trunk/jython/README.txt 2009-03-10 19:12:24 UTC (rev 6089) +++ trunk/jython/README.txt 2009-03-10 19:28:52 UTC (rev 6090) @@ -2,7 +2,7 @@ ======================= This is the forth beta of the 2.5 version of Jython. It contains a couple of -bug fixes since the 2.5b2 release a couple of days ago. The bug that promted +bug fixes since the 2.5b2 release a couple of days ago. The bug that prompted another release was a corner case on Windows that caused Jython to not start. This beta contains all of the new features for the eventual 2.5 release and represents a feature freeze. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-10 19:12:30
|
Revision: 6089 http://jython.svn.sourceforge.net/jython/?rev=6089&view=rev Author: fwierzbicki Date: 2009-03-10 19:12:24 +0000 (Tue, 10 Mar 2009) Log Message: ----------- Tag another beta in response to a Windows bug. Added Paths: ----------- tags/Release_2_5beta3/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-10 19:00:06
|
Revision: 6088 http://jython.svn.sourceforge.net/jython/?rev=6088&view=rev Author: fwierzbicki Date: 2009-03-10 18:59:50 +0000 (Tue, 10 Mar 2009) Log Message: ----------- increment version and README for another beta. Modified Paths: -------------- trunk/jython/README.txt trunk/jython/build.xml Modified: trunk/jython/README.txt =================================================================== --- trunk/jython/README.txt 2009-03-10 18:47:33 UTC (rev 6087) +++ trunk/jython/README.txt 2009-03-10 18:59:50 UTC (rev 6088) @@ -1,9 +1,11 @@ -Welcome to Jython 2.5b2 +Welcome to Jython 2.5b3 ======================= -This is the third beta of the 2.5 version of Jython. It -contains all of the new features for the 2.5 release and represents a feature -freeze. +This is the forth beta of the 2.5 version of Jython. It contains a couple of +bug fixes since the 2.5b2 release a couple of days ago. The bug that promted +another release was a corner case on Windows that caused Jython to not start. +This beta contains all of the new features for the eventual 2.5 release and +represents a feature freeze. The release was compiled on Mac OS X with JDK 5 and requires JDK 5 to run. Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2009-03-10 18:47:33 UTC (rev 6087) +++ trunk/jython/build.xml 2009-03-10 18:59:50 UTC (rev 6088) @@ -188,13 +188,13 @@ <property name="PY_RELEASE_LEVEL_SNAPSHOT" value="170"/> <!-- 0xAA --> <!-- The current version info --> - <property name="jython.version" value="2.5b2+"/> - <property name="jython.version.noplus" value="2.5b2"/> + <property name="jython.version" value="2.5b3+"/> + <property name="jython.version.noplus" value="2.5b3"/> <property name="jython.major_version" value="2"/> <property name="jython.minor_version" value="5"/> <property name="jython.micro_version" value="0"/> <property name="jython.release_level" value="${PY_RELEASE_LEVEL_BETA}"/> - <property name="jython.release_serial" value="2"/> + <property name="jython.release_serial" value="3"/> <condition property="do.snapshot.build"> <isset property="snapshot.revision" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-10 18:47:46
|
Revision: 6087 http://jython.svn.sourceforge.net/jython/?rev=6087&view=rev Author: fwierzbicki Date: 2009-03-10 18:47:33 +0000 (Tue, 10 Mar 2009) Log Message: ----------- Unit tests and fix for http://bugs.jython.org/issue1126 "ImportError raised for Java subpackages import". Thanks to boisgera for the report and for the unit testing code. Modified Paths: -------------- trunk/jython/Lib/test/test_classpathimporter.py trunk/jython/NEWS trunk/jython/src/org/python/core/imp.java Added Paths: ----------- trunk/jython/Lib/test/bug1126/ trunk/jython/Lib/test/bug1126/bug1126.jar Added: trunk/jython/Lib/test/bug1126/bug1126.jar =================================================================== (Binary files differ) Property changes on: trunk/jython/Lib/test/bug1126/bug1126.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/jython/Lib/test/test_classpathimporter.py =================================================================== --- trunk/jython/Lib/test/test_classpathimporter.py 2009-03-10 17:29:42 UTC (rev 6086) +++ trunk/jython/Lib/test/test_classpathimporter.py 2009-03-10 18:47:33 UTC (rev 6087) @@ -48,6 +48,12 @@ sys.path.append("Lib/test/bug1239.jar") import org.test403javapackage.test403 + # different from test_bug1239 in that only a Java package is imported, not + # a Java class. I'd also like to get rid of this checked in test jar. + def test_bug1126(self): + sys.path.append("Lib/test/bug1126/bug1126.jar") + import org.subpackage + def test_main(): test_support.run_unittest(ClasspathImporterTestCase) Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2009-03-10 17:29:42 UTC (rev 6086) +++ trunk/jython/NEWS 2009-03-10 18:47:33 UTC (rev 6087) @@ -2,6 +2,7 @@ Jython 2.5 Bugs fixed (new numbering due to move to Roundup) + - [ 1126 ] ImportError raised for Java subpackages import - [ 1111 ] keyword arguments not supported on __import__ - [ 1567212 ] Jython $py.class bytecode doesn't include the .py's mtime - [ 1024 ] Jython $py.class bytecode doesn't include the .py's mtime Modified: trunk/jython/src/org/python/core/imp.java =================================================================== --- trunk/jython/src/org/python/core/imp.java 2009-03-10 17:29:42 UTC (rev 6086) +++ trunk/jython/src/org/python/core/imp.java 2009-03-10 18:47:33 UTC (rev 6087) @@ -635,9 +635,20 @@ } else { name = dottedName.substring(last_dot, dot); } + PyJavaPackage jpkg = null; + if (mod instanceof PyJavaPackage) { + jpkg = (PyJavaPackage)mod; + } + mod = import_next(mod, parentNameBuffer, name, fullName, fromlist); + if (jpkg != null && (mod == null || mod == Py.None)) { + // try again -- under certain circumstances a PyJavaPackage may + // have been added as a side effect of the last import_next + // attempt. see Lib/test_classpathimport.py#test_bug1126 + mod = import_next(jpkg, parentNameBuffer, name, fullName, fromlist); + } if (mod == null || mod == Py.None) { - throw Py.ImportError("No module named " + name); + throw Py.ImportError("No module named " + name); } last_dot = dot + 1; } while (dot != -1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2009-03-10 17:29:44
|
Revision: 6086 http://jython.svn.sourceforge.net/jython/?rev=6086&view=rev Author: otmarhumbel Date: 2009-03-10 17:29:42 +0000 (Tue, 10 Mar 2009) Log Message: ----------- fix for issue 1269: correctly build the -classpath option even if there is no environment variable CLASSPATH defined Modified Paths: -------------- trunk/jython/src/shell/jython.bat Modified: trunk/jython/src/shell/jython.bat =================================================================== --- trunk/jython/src/shell/jython.bat 2009-03-08 04:34:13 UTC (rev 6085) +++ trunk/jython/src/shell/jython.bat 2009-03-10 17:29:42 UTC (rev 6086) @@ -160,7 +160,13 @@ goto scanArgs :argsDone -if not defined _BOOT_CP set CLASSPATH=%_CP:"=%;%CLASSPATH:"=% +if not defined _BOOT_CP ( + if defined CLASSPATH ( + set CLASSPATH=%_CP:"=%;%CLASSPATH:"=% + ) else ( + set CLASSPATH=%_CP:"=% + ) +) %_JAVA_CMD% %_JAVA_OPTS% %_JAVA_STACK% %_BOOT_CP% -Dpython.home=%_JYTHON_HOME% -Dpython.executable="%~f0" -classpath "%CLASSPATH%" org.python.util.jython %_JYTHON_OPTS% %_JYTHON_ARGS% %_ARGS% set E=%ERRORLEVEL% This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zy...@us...> - 2009-03-08 04:34:28
|
Revision: 6085 http://jython.svn.sourceforge.net/jython/?rev=6085&view=rev Author: zyasoft Date: 2009-03-08 04:34:13 +0000 (Sun, 08 Mar 2009) Log Message: ----------- PyStringMap#setdefault should use putIfAbsent, just like PyDictionary#setdefault. Fixes #735205. Modified Paths: -------------- trunk/jython/src/org/python/core/PyStringMap.java Modified: trunk/jython/src/org/python/core/PyStringMap.java =================================================================== --- trunk/jython/src/org/python/core/PyStringMap.java 2009-03-08 04:10:37 UTC (rev 6084) +++ trunk/jython/src/org/python/core/PyStringMap.java 2009-03-08 04:34:13 UTC (rev 6085) @@ -7,6 +7,7 @@ import java.util.Set; import java.util.Map.Entry; import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; /** * Special fast dict implementation for __dict__ instances. Allows interned String keys in addition @@ -14,7 +15,7 @@ */ public class PyStringMap extends PyObject { - private final Map<Object, PyObject> table; + private final ConcurrentMap<Object, PyObject> table; public PyStringMap() { this(4); @@ -334,11 +335,13 @@ * the default value to insert in the mapping if key does not already exist. */ public PyObject setdefault(PyObject key, PyObject failobj) { - PyObject o = __finditem__(key); - if (o == null) { - __setitem__(key, o = failobj); + Object internedKey = (key instanceof PyString) ? ((PyString)key).internedString() : key; + PyObject oldValue = table.putIfAbsent(internedKey, failobj); + if (oldValue == null) { + return failobj; + } else { + return oldValue; } - return o; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zy...@us...> - 2009-03-08 04:11:01
|
Revision: 6084 http://jython.svn.sourceforge.net/jython/?rev=6084&view=rev Author: zyasoft Date: 2009-03-08 04:10:37 +0000 (Sun, 08 Mar 2009) Log Message: ----------- Re-enabled test_asynchat for all platforms Modified Paths: -------------- trunk/jython/Lib/test/regrtest.py Removed Paths: ------------- trunk/jython/Lib/test/test_asynchat.py Modified: trunk/jython/Lib/test/regrtest.py =================================================================== --- trunk/jython/Lib/test/regrtest.py 2009-03-07 17:57:57 UTC (rev 6083) +++ trunk/jython/Lib/test/regrtest.py 2009-03-08 04:10:37 UTC (rev 6084) @@ -1535,8 +1535,6 @@ self.expected.add('test_mhlib') import platform os_name = platform.java_ver()[3][0] - if os_name == 'Mac OS X' or 'BSD' in os_name: - self.expected.add('test_asynchat') self.valid = True Deleted: trunk/jython/Lib/test/test_asynchat.py =================================================================== --- trunk/jython/Lib/test/test_asynchat.py 2009-03-07 17:57:57 UTC (rev 6083) +++ trunk/jython/Lib/test/test_asynchat.py 2009-03-08 04:10:37 UTC (rev 6084) @@ -1,100 +0,0 @@ -# test asynchat -- requires threading - -import thread # If this fails, we can't test this module -import asyncore, asynchat, socket, threading, time -import unittest -from test import test_support - -import platform -os_name = platform.java_ver()[3][0] -if os_name == 'Mac OS X' or os_name == 'SunOS' or 'BSD' in os_name \ - or 'Windows' in os_name: - raise test_support.TestSkipped('test_asynchat deadlocks on Jython: ' - 'http://bugs.jython.org/issue1064') - -HOST = "127.0.0.1" -PORT = 54322 - -class echo_server(threading.Thread): - - def run(self): - sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) - sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - global PORT - PORT = test_support.bind_port(sock, HOST, PORT) - sock.listen(1) - conn, client = sock.accept() - buffer = "" - while "\n" not in buffer: - data = conn.recv(1) - if not data: - break - buffer = buffer + data - while buffer: - n = conn.send(buffer) - buffer = buffer[n:] - conn.close() - sock.close() - -class echo_client(asynchat.async_chat): - - def __init__(self, terminator): - asynchat.async_chat.__init__(self) - self.contents = None - self.create_socket(socket.AF_INET, socket.SOCK_STREAM) - self.connect((HOST, PORT)) - self.set_terminator(terminator) - self.buffer = "" - - def handle_connect(self): - pass - ##print "Connected" - - def collect_incoming_data(self, data): - self.buffer = self.buffer + data - - def found_terminator(self): - #print "Received:", repr(self.buffer) - self.contents = self.buffer - self.buffer = "" - self.close() - - -class TestAsynchat(unittest.TestCase): - def setUp (self): - pass - - def tearDown (self): - pass - - def test_line_terminator(self): - s = echo_server() - s.start() - time.sleep(1) # Give server time to initialize - c = echo_client('\n') - c.push("hello ") - c.push("world\n") - asyncore.loop() - s.join() - - self.assertEqual(c.contents, 'hello world') - - def test_numeric_terminator(self): - # Try reading a fixed number of bytes - s = echo_server() - s.start() - time.sleep(1) # Give server time to initialize - c = echo_client(6L) - c.push("hello ") - c.push("world\n") - asyncore.loop() - s.join() - - self.assertEqual(c.contents, 'hello ') - - -def test_main(verbose=None): - test_support.run_unittest(TestAsynchat) - -if __name__ == "__main__": - test_main(verbose=True) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-07 17:58:19
|
Revision: 6083 http://jython.svn.sourceforge.net/jython/?rev=6083&view=rev Author: fwierzbicki Date: 2009-03-07 17:57:57 +0000 (Sat, 07 Mar 2009) Log Message: ----------- tag beta2 release. Added Paths: ----------- tags/Release_2_5beta2/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zy...@us...> - 2009-03-07 16:00:46
|
Revision: 6082 http://jython.svn.sourceforge.net/jython/?rev=6082&view=rev Author: zyasoft Date: 2009-03-07 16:00:32 +0000 (Sat, 07 Mar 2009) Log Message: ----------- Use a PyList instead to store the block stack for the PBC-VM. Modified Paths: -------------- trunk/jython/src/org/python/core/PyBytecode.java Modified: trunk/jython/src/org/python/core/PyBytecode.java =================================================================== --- trunk/jython/src/org/python/core/PyBytecode.java 2009-03-07 15:57:43 UTC (rev 6081) +++ trunk/jython/src/org/python/core/PyBytecode.java 2009-03-07 16:00:32 UTC (rev 6082) @@ -230,26 +230,24 @@ } } - // the following code exploits the fact that f_exits and f_lineno are only used by code compiled to Java bytecode; + // the following code exploits the fact that f_exits is only used by code compiled to Java bytecode; // in their place we implement the block stack for PBC-VM, as mapped below in the comments of pushBlock private static PyTryBlock popBlock(PyFrame f) { - PyTryBlock block = (PyTryBlock) (f.f_exits[--f.f_lineno]); - f.f_exits[f.f_lineno] = null; // ensure eventual GC of this reference - return block; + return (PyTryBlock)(((PyList)f.f_exits[0]).pop()); } private static void pushBlock(PyFrame f, PyTryBlock block) { if (f.f_exits == null) { // allocate in the frame where they can fit! TODO consider supporting directly in the frame - f.f_exits = new PyObject[CO_MAXBLOCKS]; // f_blockstack in CPython - a simple ArrayList might be best - f.f_lineno = 0; // f_iblock in CPython + f.f_exits = new PyObject[1]; // f_blockstack in CPython - a simple ArrayList might be best + f.f_exits[0] = new PyList(); } - f.f_exits[f.f_lineno++] = block; + ((PyList)f.f_exits[0]).append(block); } private boolean blocksLeft(PyFrame f) { if (f.f_exits != null) { - return f.f_lineno > 0; + return ((PyList)f.f_exits[0]).__nonzero__(); } else { return false; } @@ -1579,6 +1577,7 @@ return lines.get(lo); } + @Override public String toString() { return addr_breakpoints.toString() + ";" + lines.toString(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-07 15:57:53
|
Revision: 6081 http://jython.svn.sourceforge.net/jython/?rev=6081&view=rev Author: fwierzbicki Date: 2009-03-07 15:57:43 +0000 (Sat, 07 Mar 2009) Log Message: ----------- Changing version numbers, README, plus some bugfix reports in NEWS (from some archeology on http://bugs.jython.org) Modified Paths: -------------- trunk/jython/NEWS trunk/jython/README.txt trunk/jython/build.xml Modified: trunk/jython/NEWS =================================================================== --- trunk/jython/NEWS 2009-03-07 15:35:39 UTC (rev 6080) +++ trunk/jython/NEWS 2009-03-07 15:57:43 UTC (rev 6081) @@ -3,6 +3,291 @@ Jython 2.5 Bugs fixed (new numbering due to move to Roundup) - [ 1111 ] keyword arguments not supported on __import__ + - [ 1567212 ] Jython $py.class bytecode doesn't include the .py's mtime + - [ 1024 ] Jython $py.class bytecode doesn't include the .py's mtime + - [ 852818 ] Wrong error message when the second+ parameter to Java wrong + - [ 1222877 ] duplicate keyword arguments + - [ 1168 ] ast module not working + - [ 1192 ] deserialization of Jython classes extending Java classes fails when called from Java + - [ 1243 ] Running scripts from standalone jar with __run__.py broken + - [ 1237 ] Asnycore does not seem to work in Jython 2.5 (b0 or b1) + - [ 1257 ] Pickling (protocol 2) doesn't use overriden itervalues() on dict-derived classes + - [ 1245 ] modjy passes HTTP headers as unicode objects to the WSGI app + - [ 1258 ] select() semantics differ from CPython, causing pydoc HTTPd to fail + - [ 1043 ] Special broadcast host address <broadcast> is not supported. + - [ 1121 ] listening socket shutdown expects the wrong kind of socket + - [ 1244 ] Problem letting system choose the port for binding UDP socket + - [ 1241 ] Assignment to static variable shadows value + - [ 1234 ] Java classes' MRO resolution can throw an NPE + - [ 1231 ] 2.5b1 breaks XML DocumentBuilderFactory (in particular, Weblogic 10.3) + - [ 1230 ] importing with '*' from java packages does not work with 2.5b1 + - [ 1242 ] Tuples allow member assignment + - [ 1239 ] Package scanning seems to depend on import order in jython-2.5b1 + - [ 1235 ] java.awt.Frame - problem w/ attibutes + - [ 1240 ] Can't import _jython, but it's listed in the built-in modules + - [ 1217 ] decompressing a malformed stream with zlib results in a java.util.zip.DataFormatException instead of a zlib.error + - [ 1227 ] The cStringIO.StringIO.write implementation does not handle write/seek/write's correctly. + - [ 1232 ] Inherited java bean properties not recognized correctly + - [ 1229 ] os.utime fails in Jython2.5b1 + - [ 1228 ] Add version for 2.5b1 to Issue (Bug) tracker + - [ 1051 ] socket does not define AF_UNSPEC and AI_PASSIVE constants + - [ 1218 ] Socket timeouts on connect not honoured when timeout set through socket.setdefaulttimeout() + - [ 1747126 ] CLASSPATH not searched correctly for python source modules + - [ 1008 ] Jython broken on Java Web Start 1.6 + - [ 1181 ] Patch against trunk to make applets work again + - [ 1122 ] os.kill is not implemented + - [ 1154 ] socket.settimeout not working for recv + - [ 1171 ] Creating a PyFile from an InputStream is broken. + - [ 1211 ] Telnetlib.expect crashes when a timeout parameter is given. + - [ 1182 ] Patch to Lib/socket.py to fix broken SSL + - [ 1083 ] jython2.5a1 installer does not create "cachedir" directory + - [ 1063 ] RuntimeError expected when stack overflows + - [ 1205 ] list comprehension difference to python + - [ 1166 ] TypeError: utimes(): 3rd arg can't be coerced to long + - [ 1025 ] imp.find_module can't find builtin modules + - [ 1758318 ] StackOverflow if __nonzero__ returns self + - [ 1815110 ] eval and excec should accept mapping type for locals + - [ 600790 ] Overriding automatically defined methods + - [ 1201 ] Lack of Python line numbers in Java tracebacks + - [ 1658599 ] headless installation not detected + - [ 1161 ] imp.find_module can't find many modules (was: pylint & logilab ASTNG library) + - [ 1199 ] zipimporter should be smarter about what files it tries to access + - [ 1180 ] virtualenv broken on installed Jython + - [ 1196 ] failure of dir() on instances of a class with __getattribute__ + - [ 1194 ] with_statement: context __exit__ not called for return + - [ 1187 ] JYTHON_OPTS broken in jython.bat + - [ 1758319 ] bool should not be subclassable + - [ 1011 ] ant task to create launcher script + - [ 1137 ] ArrayType missing in Jython 2.5a3 + - [ 1058 ] Carlo Verre's object.__setattr__ hack allows modification of built in types + - [ 1222918 ] -C NONE causes exception + - [ 1604258 ] copy.copy doesn't work on subclasses of newstyle classes + - [ 1798554 ] zlib.__doc__ is not showing any output + - [ 1798556 ] patch for :[ 1798554 ] zlib.__doc__ is not showing any outpu + - [ 1003 ] struct packing inconsistent with CPython + - [ 1052 ] __int__ returning PyLong = ClassCastException mayhem + - [ 1167 ] random.py in standard library is broken in 2.5beta0 + - [ 1138 ] __file__ reflects original source location, not the pathname of the $py.class file + - [ 1174 ] NPE on PythonInterpreter.eval() + - [ 1173 ] undefined sys.prefix breaks initialization + - [ 1177 ] utf-8 codec isn't? + - [ 1835099 ] Bug in list.sort() + - [ 1141 ] Incorrect __import__ calls + - [ 1780767 ] Fix for [ 1768075 ] %c formats values outside of the + - [ 1115 ] __lt__ in a derived list produces a StackOverflowError + - [ 1062 ] Doctest does not work against unicode strings + - [ 1783868 ] __ge__ or __gt__ of subclass of str --> StackOverflowError + - [ 1125 ] not valid JAVA_HOME path + - [ 1777567 ] Type of reflected methods is different for Java and Python + - [ 513713 ] PyTableCode != PyCode + - [ 526672 ] inspect not supported + - [ 1754240 ] Error Message when attempting to bind to an in use Port + - [ 1159 ] custum number and float: unsupported operand type(s) for * + - [ 1158 ] compile() fails to recognize initial AST arg + - [ 1155 ] inet_ntoa missing from socket + - [ 1150 ] Nested generator expressions do not compile + - [ 1113 ] Syntax + Compiler Error + - [ 1157 ] Support pylint + - [ 1156 ] rfc822.py incompatible with PyFile(java.io.InputStream istream) + - [ 1128 ] java.lang.String should be mapped to PyUnicode, not PyString + - [ 1111 ] keyword arguments not supported on __import__ + - [ 1114 ] Compiler Error - null pointer + - [ 1134 ] Built-in functions should be of type types.BuiltinFunction + - [ 1075 ] os.rmdir deletes file + - [ 1136 ] Parsing a module fails if it ends with whitespace but no newline + - [ 1131 ] repr not 100% CPython compliant + - [ 1626844 ] fixes for failing binascii unit tests (2.3 branch) + - [ 1838658 ] 'platform' module is not available + - [ 1663711 ] 32767 characters is max string constant size + - [ 1847091 ] del statement doesn't work on builtin modules + - [ 1768969 ] filter doesn't return passed in subclass type + - [ 1047 ] xml.dom.pulldom doesn't work + - [ 1835109 ] Patch for [ 1835098 ] No decimal module available in jython + - [ 1768970 ] pyget used instead of __getitem__ in __iter__, filter + - [ 1768968 ] unicode bom isn't recognized to indicate unicode for parsing + - [ 1785475 ] patch for bug IDs 1768970, 1782565 & 1783868 + - [ 1738411 ] Unable to change function sys.settrace + - [ 1761111 ] Patch for PEP 292 Simpler String Substitutions + - [ 1835119 ] 'platform' module is not available in jython + - [ 1840479 ] coding: utf-8 and PEP 0263? + - [ 1835098 ] No decimal module available in jython + - [ 1717492 ] os.path.ismount incompletely implemented + - [ 1067 ] class / function call behaviour (Jython vs. CPython) + - [ 1091 ] Interactive Interpreter parser doesn't handle docstrings + - [ 1022 ] Class definitions aren't provided a __module__ variable + - [ 1120 ] invalid socket shutdown gives AssertionError, should be "transport endpoint not connected" socket.error + - [ 1119 ] socket module has no attribute SO_ERROR + - [ 1081 ] Jython 2.5a1 standalone installer hangs + - [ 1123 ] Weird "unexpected at this time" error. + - [ 1070 ] Standalone crashes with ZipException + - [ 1077 ] Standalone installation fails + - [ 1094 ] mismatched input class parsing error on "class" attributes of a java object + - [ 1015 ] unicode string combination with % behaves unexpectedly + - [ 1758279 ] Java classes exposed as Python classes but have no __module__ + - [ 1116 ] parser NPE on dotted (more than 1) attribute decorators + - [ 1758325 ] str's formatter doesn't raise TypeError if given wrong type + - [ 1095 ] AttributeError raised from __getattr__ method are swallowed + - [ 1106 ] os.getpid() call missing + - [ 1104 ] subprocess.Popen doesn't inherits os.environ to the spawned processes + - [ 1041 ] AttributeError raised from descriptors __get__ method are swallowed + - [ 1869347 ] TypeError while used derived class of long for comparison + - [ 1072 ] Parsing error in file with white space at the end + - [ 1045 ] PyBoolean.__tojava__(Object.class) should return a Boolean + - [ 1044 ] Patch to support for BigIntegers and PyLong on the PostgresqlDataHandler + - [ 1054 ] Patch: Fastpath for cursor.executemany() + - [ 1053 ] Better string interpolation with unicode args + - [ 1804011 ] classes extending dict can't be compared to dict + - [ 1889394 ] UnicodeDerived's == is broken + - [ 1060 ] deriveds don't support coerce + - [ 1650802 ] _csv module + - [ 1092 ] Parser problems on Django tree + - [ 1050 ] Don't display banner/prompts when stdin is not a tty + - [ 1069 ] setuptools: 'NoneType' object has no attribute 'startswith' + - [ 1093 ] Installer 2.5a1 on MS Windows: Incorrect jar is referred to in bin/jython + - [ 1605009 ] str subclasses can be used in raise + - [ 1079 ] twisted.python.threadable module: missing attribute '_RLock' + - [ 1088 ] Existing .py$class files from Jy2.2 cause error for Jy2.5a + - [ 1086 ] Handling of """quoted strings""" for 2.5a differs from Jy2.2 and Py2.5 + - [ 1087 ] assert error message at end of Python script differs from Py2.5 + - [ 1082 ] asm parser can't handle PySourceColor module + - [ 1767742 ] array.array('xx') should throw TypeError, not ValueError + - [ 1076 ] 2.5a1 jython.bat doesn't work from Windows explorer + - [ 1059 ] Possible to construct long(None) + - [ 1873148 ] list.__iadd__ not switching to __radd__ on NotImplemented + - [ 1056 ] Bad mro() overrides not caught + - [ 1886758 ] from __future__ import division leaks out of namespace + - [ 1879935 ] cPython/Jython different os.path.isabs() behavior + - [ 1879984 ] cPython/Jython different os.path.realpath() behavior + - [ 1879989 ] cPython/Jython different os.path.abspath() behavior + - [ 1605006 ] __doc__ descriptor on new style class returned directly + - [ 1639663 ] Patch for [ 1605006 ] __doc__ descriptor on new style class + - [ 1803960 ] Attribute Error :- 'slice' object has no attribute 'indice + - [ 1802863 ] zipfile.is_zipfile never returns False + - [ 678557 ] cgi parsing of multipart/form-data broken + - [ 1840038 ] patch for PyUnicode (fixes [ 1782565 ]) + - [ 1754222 ] raising SystemExit in a thread causes jython to quit + - [ 811908 ] OutOfMemoryError causes exit without a call to a handler + - [ 654142 ] NPE when converting __dict__ to list + - [ 515497 ] method instance not unique key in dict + - [ 718377 ] PyObject.__findattr_ throws NPE + - [ 753790 ] struct module inconsistent with CPython + - [ 1009477 ] Python collections should implement java interfaces + - [ 1599050 ] fileinput os.fstat fix + - [ 1676293 ] metaclass __init__ dct reference + - [ 1038 ] Custom KeyErrors raised from __getitem__ are swallowed + - [ 1039 ] AttributeError message on type instances doesn't match the CPython message + - [ 1048 ] List Comprehension in finally throws NPE + - [ 1037 ] float(None) throws AttributeError instead of TypeError + - [ 1814929 ] Patch for [ 1814904 ] dict.update() doesnt accept arguments + - [ 1814904 ] dict.update() doent accept the same arguments as constructor + - [ 947306 ] 2.3a0 bug in weakref.WeakValueDictionary + - [ 1016 ] Support socket.TCP_NODELAY + - [ 1033 ] zlib.adler32 computes wrong values + - [ 1797751 ] patch for :[ 1796272 ] partition and rpartition methods are + - [ 1796272 ] partition and rpartition methods are missing in jython + - [ 1040 ] KeyError.__str__ doesn't use repr() + - [ 1036 ] make Jython set pass (almost) all CPython tests + - [ 1035 ] set incorrectly raises TypeError when asked for superset/subset on non-set iterables + - [ 1034 ] can't supply dict() for globals in FunctionType() + - [ 1782565 ] Mismatch in repr of obj of unicode and subclass of unicode + - [ 1510227 ] difference between repr() and __repr__() + - [ 1501932 ] hasattr invokes __getattr__ + - [ 1775263 ] patch for bug [1768979]:hasattr,getattr + - [ 1768979 ] hasattr, getattr allow unicode identifiers + - [ 1780153 ] Fix for [ 1768075 ] %c formats values outside of the + - [ 1768075 ] %c formats values outside of the size of a single char + - [ 1803425 ] new builtin funcion :- sorted() - a new builtin sorted() act + - [ 1758282 ] complex missing __coerce__ + - [ 1777684 ] int and long types are missing __coerce__ + - [ 1785415 ] patch for : [ 1777684 ] int and long types are missing __coe + - [ 1514533 ] PyComplex in branch 2.3 + - [ 1783088 ] patch for :[ 1758282 ] complex missing __coerce__ + - [ 1758284 ] Complex parses complex('1' * 500) as (Infinity+0j) + - [ 1779428 ] patch for : [ 1758284 ] Complex parses complex('1' * 500) as + - [ 1671213 ] pickle/cPickle of Sets bug + - [ 1019 ] Can't change new-style class __name__ + - [ 1013 ] jython crash with command: threading.local() + - [ 1009 ] Patch to add 'at' to the repr string. + - [ 1005 ] UDP Socket implicit create and unbound socket timeout + - [ 1755346 ] imp missing lock_help + - [ 1758322 ] List mutation during sort doesn't throw a ValueError + - [ 1006 ] __import__ fromlist doesn't get processed + - [ 1782548 ] UDP send blocks with reader thread present + - [ 1895736 ] cleanup os.environ + - [ 1717491 ] os.path.islink incompletely implemented + - [ 1718450 ] Patch for os.path.islink bug 1717491 + - [ 1718975 ] Patch for os.path.normcase bug 1648449 + - [ 1648449 ] os.path.normcase broken in Windows + - [ 1814527 ] patch for [1803425], [1758322], [1785366] and upgraded sort + - [ 1861985 ] extending java classes from python code fails + - [ 1871739 ] fix for Import Error statement to match CPython + - [ 1870039 ] Debugging facility not behaving correctly with threads + - [ 1757127 ] Jython hangs under PyDev debugger + - [ 1839038 ] operations returning bools still return 1/0s + - [ 1861973 ] importing modules from class broken + - [ 1861974 ] patch for [1861973]. problems loading $py.class files + - [ 1850722 ] socket.py - ClientCookie and ClientForm + - [ 1482645 ] More OS recognition + - [ 1509095 ] Can't open midi sequencer + - [ 1850207 ] socket._fileobject - AttributeError: 'module' object has no + - [ 1816103 ] org.python.core.PyDictionary should implement java.util.Map + - [ 1721204 ] there is no threading.local() + - [ 1841639 ] Filecmp module is not in jython + - [ 1842984 ] Py.tojava(PyObject, Class) incorrectly marked deprecated + - [ 1841445 ] NPE in PythonInterpreter.get(String name, Class javaclass) + - [ 481404 ] CR removed on reading text on unix + - [ 1159156 ] codec.open() does not work with different systemstates + - [ 1261231 ] JButton('\u0F00') not working + - [ 1674190 ] exec() destroys multibyte string + - [ 1599900 ] Incorrect usage of String.getBytes() + - [ 1611604 ] PyFile hand-edited code + - [ 1839871 ] dict shouldn't call __setitem__ to initialise + - [ 1816134 ] Issue with Key Comparison in Dicts + - [ 1818353 ] sliceLength of PySequence returns 0 when step is sys.maxint + - [ 1791931 ] slice should be a type + - [ 1812122 ] NullPointerException when rethrowing an exception + - [ 1814678 ] Lack of some public functions' names in __all__ (javaos.py) + - [ 1796415 ] javaos.py missing removedirs function + - [ 1796425 ] javaos.py missing renames function. + - [ 1838358 ] Improve Resolution in time.clock() + - [ 1818393 ] why using Deprecated method in PyString? + - [ 1783692 ] Implementation of tempfile with secure files + - [ 1755344 ] tempfile missing mkdtemp + - [ 1817908 ] Broken link for corner icon in html documentation + - [ 1831710 ] PyFileCloser throws NullPointerException on shutdown + - [ 1744567 ] Simultaneous read & write on socket FileWrapper causes hang + - [ 1806980 ] os.path.join ignores empty string + - [ 1812913 ] File read converts \r to \n + - [ 1781500 ] Metaclasses don't get passed a '__module__' in attrs + - [ 1801802 ] JavaImportHelper not thread safe + - [ 1800378 ] object.__unicode__ should it exist? + - [ 1768982 ] sys.exc_clear is missing + - [ 1735774 ] Redirecting stdout/err with os.popen fails if cmd is unicode + - [ 1763263 ] os.utime(path, None) doesn't work (incl. a patch) + - [ 1758904 ] I added doc strings for functions in os module (javaos.py). + - [ 1768074 ] str.replace doesn't handle an empty string to be replaced + - [ 1799328 ] Unicode string interpolation doesn't work + - [ 1773865 ] Patch for [1768990] pickle fails on subclasses + - [ 1768990 ] pickle fails on subclasses of builtin types + - [ 1782493 ] On cli $ ./jython --version missing java version number + - [ 1783153 ] Patch: compatibility with Java 1.3 for Jython 2.2 + - [ 1755361 ] file missing 'U' universal newline mode + - [ 1782856 ] Error in zxJDBC.Timestamp() + - [ 1767194 ] Wrong namespace in xmllib in 2.2rc3 (patch included) + - [ 1783803 ] patch for bug [1775893] :in keyword + - [ 1775893 ] in keyword does not use dict.has_key() + - [ 1783960 ] can not exclude parts from installation + - [ 1785638 ] ImportError from zip without source + - [ 1783554 ] CPython compatible zipimporter + - [ 1775078 ] Fix binary operations on str/unicode/lists/tuples + - [ 1781556 ] Support list.extend(iterator), and other sequence fixes + - [ 1784564 ] Add PyLong.asInt + - [ 1768984 ] sys.builtin_module_names is missing + - [ 1768988 ] isinstance, issubclass allow a StackOverflow + - [ 1291509 ] cPickling bug + - [ 1758315 ] org.python.modules.operator lacks is and is_not functions + - [ 1758312 ] date and time objects fail to pickle + - [ 1758317 ] bool objects fail to pickle Incompatible Changes - The python.prepath property has been removed; use python.path instead. @@ -10,10 +295,14 @@ Collection instead of a PyList - The -E codec command line option (use a different codec when reading from the console) has been changed to -C codec - + - import of Python modules does not imply the import of child modules, though + import of Java packages still does, see email thread with Guido van Rossum, + Samuele Pedroni, and Frank Wierzbicki: + http://www.mailinglistarchive.com/pyt...@py.../msg07683.html + New Features - PyDictionary now implements Map so it may be passed to any Java function expecting a Map. - + - modjy integrated into core Ported Modules - collections - filecmp Modified: trunk/jython/README.txt =================================================================== --- trunk/jython/README.txt 2009-03-07 15:35:39 UTC (rev 6080) +++ trunk/jython/README.txt 2009-03-07 15:57:43 UTC (rev 6081) @@ -1,8 +1,9 @@ -Welcome to Jython 2.5b1 +Welcome to Jython 2.5b2 ======================= -This is the second beta of the 2.5 version of Jython. It -contains most of the new features for the 2.5 release. +This is the third beta of the 2.5 version of Jython. It +contains all of the new features for the 2.5 release and represents a feature +freeze. The release was compiled on Mac OS X with JDK 5 and requires JDK 5 to run. Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2009-03-07 15:35:39 UTC (rev 6080) +++ trunk/jython/build.xml 2009-03-07 15:57:43 UTC (rev 6081) @@ -188,13 +188,13 @@ <property name="PY_RELEASE_LEVEL_SNAPSHOT" value="170"/> <!-- 0xAA --> <!-- The current version info --> - <property name="jython.version" value="2.5b1+"/> - <property name="jython.version.noplus" value="2.5b1"/> + <property name="jython.version" value="2.5b2+"/> + <property name="jython.version.noplus" value="2.5b2"/> <property name="jython.major_version" value="2"/> <property name="jython.minor_version" value="5"/> <property name="jython.micro_version" value="0"/> <property name="jython.release_level" value="${PY_RELEASE_LEVEL_BETA}"/> - <property name="jython.release_serial" value="0"/> + <property name="jython.release_serial" value="2"/> <condition property="do.snapshot.build"> <isset property="snapshot.revision" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <am...@us...> - 2009-03-07 15:35:58
|
Revision: 6080 http://jython.svn.sourceforge.net/jython/?rev=6080&view=rev Author: amak Date: 2009-03-07 15:35:39 +0000 (Sat, 07 Mar 2009) Log Message: ----------- Now that modjy is fully integrated, we no longer need the .zip version in extlibs. Modified Paths: -------------- trunk/jython/build.xml Removed Paths: ------------- trunk/jython/extlibs/modjy_0_25_3.zip Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2009-03-07 04:16:00 UTC (rev 6079) +++ trunk/jython/build.xml 2009-03-07 15:35:39 UTC (rev 6080) @@ -648,7 +648,6 @@ <include name="src/org/**/ucnhash.dat" /> <include name="grammar/*.g" /> <include name="extlibs/**/*.jar" /> - <include name="extlibs/**/*.zip" /> <include name="tests/java/**/*.java" /> <include name="CoreExposed.includes" /> </fileset> Deleted: trunk/jython/extlibs/modjy_0_25_3.zip =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Frank W. <fwi...@gm...> - 2009-03-07 13:47:04
|
On Sat, Mar 7, 2009 at 3:07 AM, Oti <oh...@gm...> wrote: > On Sat, Mar 7, 2009 at 5:16 AM, <fwi...@us...> wrote: >> Revision: 6079 >> http://jython.svn.sourceforge.net/jython/?rev=6079&view=rev >> Author: fwierzbicki >> Date: 2009-03-07 04:16:00 +0000 (Sat, 07 Mar 2009) >> >> Log Message: >> ----------- >> increment APIVersion, take --verify out of build.xml > > Frank, > > thank you very much for helping me out here - i should have run the > regrtests myself ! No worries, I really appreciate how quickly you put this stuff together. I also appreciate your advocacy of new users. --boot is definitely the right way to go vs --verify. Thanks! -Frank |
From: Oti <oh...@gm...> - 2009-03-07 08:07:31
|
On Sat, Mar 7, 2009 at 5:16 AM, <fwi...@us...> wrote: > Revision: 6079 > http://jython.svn.sourceforge.net/jython/?rev=6079&view=rev > Author: fwierzbicki > Date: 2009-03-07 04:16:00 +0000 (Sat, 07 Mar 2009) > > Log Message: > ----------- > increment APIVersion, take --verify out of build.xml Frank, thank you very much for helping me out here - i should have run the regrtests myself ! The waterfall buildbot also has --verify hardcoded (i assume). This is another proof that you can mess up a lot by changing the shell scripts... Oti. |
From: <fwi...@us...> - 2009-03-07 04:16:09
|
Revision: 6079 http://jython.svn.sourceforge.net/jython/?rev=6079&view=rev Author: fwierzbicki Date: 2009-03-07 04:16:00 +0000 (Sat, 07 Mar 2009) Log Message: ----------- increment APIVersion, take --verify out of build.xml Modified Paths: -------------- trunk/jython/build.xml trunk/jython/src/org/python/core/imp.java Modified: trunk/jython/build.xml =================================================================== --- trunk/jython/build.xml 2009-03-07 04:05:04 UTC (rev 6078) +++ trunk/jython/build.xml 2009-03-07 04:16:00 UTC (rev 6079) @@ -831,7 +831,6 @@ <target name="regrtest" depends="developer-build,regrtest-unix,regrtest-windows"/> <target name="regrtest-unix" if="os.family.unix"> <exec executable="${dist.dir}/bin/jython"> - <arg value="--verify"/> <arg value="-J${regrtest.Xmx}"/> <arg value="${dist.dir}/Lib/test/regrtest.py"/> <!-- Only run the tests that are expected to work on Jython --> Modified: trunk/jython/src/org/python/core/imp.java =================================================================== --- trunk/jython/src/org/python/core/imp.java 2009-03-07 04:05:04 UTC (rev 6078) +++ trunk/jython/src/org/python/core/imp.java 2009-03-07 04:16:00 UTC (rev 6079) @@ -20,7 +20,7 @@ private static final String UNKNOWN_SOURCEFILE = "<unknown>"; - public static final int APIVersion = 17; + public static final int APIVersion = 18; public static final int NO_MTIME = -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <zy...@us...> - 2009-03-07 04:05:17
|
Revision: 6078 http://jython.svn.sourceforge.net/jython/?rev=6078&view=rev Author: zyasoft Date: 2009-03-07 04:05:04 +0000 (Sat, 07 Mar 2009) Log Message: ----------- Now uses CompilerFlags instead of the co_flags bit vector uniformly in the code. This change enables more programmatic direction of the compiler, including at the very least the desired compiler (once we include more than one!). Removed unnecessary fields in PyFrame that supported the former newcompiler. Made public some additional PyUnicode constructors to support the Java version of unicodedata, whenever that happens. Fixed a memory leak in PyBytecode. Modified Paths: -------------- trunk/jython/src/org/python/core/CompilerFlags.java trunk/jython/src/org/python/core/Py.java trunk/jython/src/org/python/core/PyBaseCode.java trunk/jython/src/org/python/core/PyBytecode.java trunk/jython/src/org/python/core/PyFrame.java trunk/jython/src/org/python/core/PyTableCode.java trunk/jython/src/org/python/core/PyUnicode.java trunk/jython/src/org/python/core/__builtin__.java trunk/jython/src/org/python/modules/_marshal.java Modified: trunk/jython/src/org/python/core/CompilerFlags.java =================================================================== --- trunk/jython/src/org/python/core/CompilerFlags.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/core/CompilerFlags.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -1,3 +1,6 @@ +// At some future point this will also be extended - in conjunction with Py#compileFlags - to add +// support for a compiler factory that user code can choose in place of the normal compiler. +// (Perhaps a better name might have been "CompilerOptions".) package org.python.core; @@ -5,6 +8,12 @@ private int co_flags; + public boolean optimized; + public boolean newlocals; + public boolean varargs; + public boolean varkeywords; + public boolean generator; + public boolean nested_scopes = true; public boolean division; public boolean generator_allowed = true; @@ -21,20 +30,26 @@ public CompilerFlags(int co_flags) { this.co_flags = co_flags; - nested_scopes = isEnabled(PyTableCode.CO_NESTED); - division = isEnabled(PyTableCode.CO_FUTUREDIVISION); - generator_allowed = isEnabled(PyTableCode.CO_GENERATOR_ALLOWED); - absolute_import = isEnabled(PyTableCode.CO_FUTURE_ABSOLUTE_IMPORT); - with_statement = isEnabled(PyTableCode.CO_WITH_STATEMENT); - only_ast = isEnabled(PyTableCode.PyCF_ONLY_AST); - dont_imply_dedent = isEnabled(PyTableCode.PyCF_DONT_IMPLY_DEDENT); - source_is_utf8 = isEnabled(PyTableCode.PyCF_SOURCE_IS_UTF8); + optimized = isEnabled(PyBaseCode.CO_OPTIMIZED); + newlocals = isEnabled(PyBaseCode.CO_NEWLOCALS); + varargs = isEnabled(PyBaseCode.CO_VARARGS); + varkeywords = isEnabled(PyBaseCode.CO_VARKEYWORDS); + generator = isEnabled(PyBaseCode.CO_GENERATOR); + nested_scopes = isEnabled(PyBaseCode.CO_NESTED); + division = isEnabled(PyBaseCode.CO_FUTUREDIVISION); + generator_allowed = isEnabled(PyBaseCode.CO_GENERATOR_ALLOWED); + absolute_import = isEnabled(PyBaseCode.CO_FUTURE_ABSOLUTE_IMPORT); + with_statement = isEnabled(PyBaseCode.CO_WITH_STATEMENT); + only_ast = isEnabled(PyBaseCode.PyCF_ONLY_AST); + dont_imply_dedent = isEnabled(PyBaseCode.PyCF_DONT_IMPLY_DEDENT); + source_is_utf8 = isEnabled(PyBaseCode.PyCF_SOURCE_IS_UTF8); } private boolean isEnabled(int codeConstant) { return (co_flags & codeConstant) != 0; } + @Override public String toString() { return String.format("CompilerFlags[division=%s nested_scopes=%s generators=%s " + "with_statement=%s absolute_import=%s only_ast=%s " @@ -43,4 +58,29 @@ dont_imply_dedent, source_is_utf8); } + public int toBits() { + return (optimized ? PyBaseCode.CO_OPTIMIZED : 0) | + (newlocals ? PyBaseCode.CO_NEWLOCALS : 0) | + (varargs ? PyBaseCode.CO_VARARGS : 0) | + (varkeywords ? PyBaseCode.CO_VARKEYWORDS : 0) | + (generator ? PyBaseCode.CO_GENERATOR : 0) | + (nested_scopes ? PyBaseCode.CO_NESTED : 0) | + (division ? PyBaseCode.CO_FUTUREDIVISION : 0) | + (generator_allowed ? PyBaseCode.CO_GENERATOR_ALLOWED : 0) | + (absolute_import ? PyBaseCode.CO_FUTURE_ABSOLUTE_IMPORT : 0) | + (with_statement ? PyBaseCode.CO_WITH_STATEMENT : 0) | + (only_ast ? PyBaseCode.PyCF_ONLY_AST : 0) | + (dont_imply_dedent ? PyBaseCode.PyCF_DONT_IMPLY_DEDENT : 0) | + (source_is_utf8 ? PyBaseCode.PyCF_SOURCE_IS_UTF8 : 0); + } + + // this will not strictly be an OR once we have other options, like a compiler factory + // in that case, we would assume + public CompilerFlags combine(CompilerFlags flags) { + return new CompilerFlags(this.toBits() | flags.toBits()); + } + + public CompilerFlags combine(int flags) { + return new CompilerFlags(this.toBits() | flags); + } } Modified: trunk/jython/src/org/python/core/Py.java =================================================================== --- trunk/jython/src/org/python/core/Py.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/core/Py.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -1613,7 +1613,7 @@ } else { PyFrame frame = Py.getFrame(); if (frame != null && frame.f_code != null) { - cflags = new CompilerFlags(frame.f_code.co_flags | flags); + cflags = frame.f_code.co_flags.combine(flags); } else { cflags = new CompilerFlags(flags); } @@ -1621,6 +1621,21 @@ return cflags; } + public static CompilerFlags getCompilerFlags(CompilerFlags flags, boolean dont_inherit) { + CompilerFlags cflags = null; + if (dont_inherit) { + cflags = flags; + } else { + PyFrame frame = Py.getFrame(); + if (frame != null && frame.f_code != null) { + cflags = frame.f_code.co_flags.combine(flags); + } else { + cflags = flags; + } + } + return cflags; + } + // w/o compiler-flags public static PyObject compile(InputStream istream, String filename, String kind) { return compile_flags(istream, filename, kind, new CompilerFlags()); Modified: trunk/jython/src/org/python/core/PyBaseCode.java =================================================================== --- trunk/jython/src/org/python/core/PyBaseCode.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/core/PyBaseCode.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -13,7 +13,7 @@ public int jy_npurecell; // internal: jython specific public String co_freevars[]; public String co_filename; - public int co_flags; + public CompilerFlags co_flags = new CompilerFlags(); public int co_nlocals; public boolean varargs, varkwargs; @@ -135,7 +135,7 @@ return call(Py.EmptyObjects, Py.NoKeywords, globals, defaults, closure); PyFrame frame = new PyFrame(this, globals); - if ((co_flags & CO_GENERATOR) != 0) { + if (co_flags.generator) { return new PyGenerator(frame, closure); } return call(frame, closure); @@ -149,7 +149,7 @@ Py.NoKeywords, globals, defaults, closure); PyFrame frame = new PyFrame(this, globals); frame.f_fastlocals[0] = arg1; - if ((co_flags & CO_GENERATOR) != 0) { + if (co_flags.generator) { return new PyGenerator(frame, closure); } return call(frame, closure); @@ -164,7 +164,7 @@ PyFrame frame = new PyFrame(this, globals); frame.f_fastlocals[0] = arg1; frame.f_fastlocals[1] = arg2; - if ((co_flags & CO_GENERATOR) != 0) { + if (co_flags.generator) { return new PyGenerator(frame, closure); } return call(frame, closure); @@ -181,7 +181,7 @@ frame.f_fastlocals[0] = arg1; frame.f_fastlocals[1] = arg2; frame.f_fastlocals[2] = arg3; - if ((co_flags & CO_GENERATOR) != 0) { + if (co_flags.generator) { return new PyGenerator(frame, closure); } return call(frame, closure); @@ -297,7 +297,7 @@ co_name, argcount)); } - if ((co_flags & CO_GENERATOR) != 0) { + if (co_flags.generator) { return new PyGenerator(frame, closure); } return call(frame, closure); @@ -313,4 +313,9 @@ protected int getline(PyFrame f) { return f.f_lineno; } + + // returns the augmented version of CompilerFlags (instead of just as a bit vector int) + public CompilerFlags getCompilerFlags() { + return co_flags; + } } Modified: trunk/jython/src/org/python/core/PyBytecode.java =================================================================== --- trunk/jython/src/org/python/core/PyBytecode.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/core/PyBytecode.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -74,9 +74,9 @@ co_cellvars = cellvars; co_freevars = freevars; co_name = name; - varargs = (flags & CO_VARARGS) != 0; - varkwargs = (flags & CO_VARKEYWORDS) != 0; - co_flags |= flags; + co_flags = new CompilerFlags(flags); + varargs = co_flags.varargs; + varkwargs = co_flags.varkeywords; co_stacksize = stacksize; co_consts = constants; @@ -156,6 +156,9 @@ if (name == "co_consts") { return new PyTuple(co_consts); } + if (name == "co_flags") { + return Py.newInteger(co_flags.toBits()); + } return super.__findattr_ex__(name); } @@ -201,11 +204,11 @@ } private static String stringify_blocks(PyFrame f) { - if (f.f_exits == null || f.f_blockstate[0] == 0) { + if (f.f_exits == null || f.f_lineno == 0) { return "[]"; } StringBuilder buf = new StringBuilder("["); - int len = f.f_blockstate[0]; + int len = f.f_lineno; for (int i = 0; i < len; i++) { buf.append(f.f_exits[i].toString()); if (i < len - 1) { @@ -227,21 +230,26 @@ } } + // the following code exploits the fact that f_exits and f_lineno are only used by code compiled to Java bytecode; + // in their place we implement the block stack for PBC-VM, as mapped below in the comments of pushBlock + private static PyTryBlock popBlock(PyFrame f) { - return (PyTryBlock) (f.f_exits[--f.f_blockstate[0]]); + PyTryBlock block = (PyTryBlock) (f.f_exits[--f.f_lineno]); + f.f_exits[f.f_lineno] = null; // ensure eventual GC of this reference + return block; } private static void pushBlock(PyFrame f, PyTryBlock block) { - if (f.f_exits == null) { // allocate in the frame where they can fit! consider supporting directly in the frame + if (f.f_exits == null) { // allocate in the frame where they can fit! TODO consider supporting directly in the frame f.f_exits = new PyObject[CO_MAXBLOCKS]; // f_blockstack in CPython - a simple ArrayList might be best - f.f_blockstate = new int[]{0}; // f_iblock in CPython - f_blockstate is likely go away soon + f.f_lineno = 0; // f_iblock in CPython } - f.f_exits[f.f_blockstate[0]++] = block; + f.f_exits[f.f_lineno++] = block; } private boolean blocksLeft(PyFrame f) { if (f.f_exits != null) { - return f.f_blockstate[0] > 0; + return f.f_lineno > 0; } else { return false; } @@ -414,7 +422,7 @@ PyObject b = stack.pop(); PyObject a = stack.pop(); - if ((co_flags & CO_FUTUREDIVISION) == 0) { + if (!co_flags.division) { stack.push(a._div(b)); } else { stack.push(a._truediv(b)); @@ -524,7 +532,7 @@ case Opcode.INPLACE_DIVIDE: { PyObject b = stack.pop(); PyObject a = stack.pop(); - if ((co_flags & CO_FUTUREDIVISION) == 0) { + if (!co_flags.division) { stack.push(a._idiv(b)); } else { stack.push(a._itruediv(b)); @@ -1242,7 +1250,7 @@ throw ts.exception; } - if ((co_flags & CO_GENERATOR) != 0 && why == Why.RETURN && retval == Py.None) { + if (co_flags.generator && why == Why.RETURN && retval == Py.None) { f.f_lasti = -1; } Modified: trunk/jython/src/org/python/core/PyFrame.java =================================================================== --- trunk/jython/src/org/python/core/PyFrame.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/core/PyFrame.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -31,12 +31,6 @@ public Object[] f_savedlocals; - /** newcompiler uses this to allow yield in loops. */ - public PyObject[] f_stackstate; - - /** newcompiler uses this to allow yield in finally. */ - public int[] f_blockstate; - private int env_j = 0; private Object generatorInput = Py.None; @@ -68,7 +62,7 @@ // This needs work to be efficient with multiple interpreter states if (locals == null && code != null) { // ! f_fastlocals needed for arg passing too - if ((code.co_flags & PyBaseCode.CO_OPTIMIZED) != 0 || code.nargs > 0) { + if (code.co_flags.optimized || code.nargs > 0) { if (code.co_nlocals > 0) { // internal: may change f_fastlocals = new PyObject[code.co_nlocals - code.jy_npurecell]; @@ -197,7 +191,7 @@ PyObject o = f_fastlocals[i]; if (o != null) f_locals.__setitem__(f_code.co_varnames[i], o); } - if ((f_code.co_flags & PyBaseCode.CO_OPTIMIZED) == 0) { + if (!f_code.co_flags.optimized) { f_fastlocals = null; } } Modified: trunk/jython/src/org/python/core/PyTableCode.java =================================================================== --- trunk/jython/src/org/python/core/PyTableCode.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/core/PyTableCode.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -45,14 +45,14 @@ co_name = name; if (varargs) { co_argcount -= 1; - co_flags |= CO_VARARGS; + co_flags.varargs = true; } this.varkwargs = varkwargs; if (varkwargs) { co_argcount -= 1; - co_flags |= CO_VARKEYWORDS; + co_flags.varkeywords = true; } - co_flags |= moreflags; + co_flags = new CompilerFlags(co_flags.toBits() | moreflags); this.funcs = funcs; this.func_id = func_id; } @@ -115,6 +115,9 @@ if (name == "co_name") { return new PyString(co_name); } + if (name == "co_flags") { + return Py.newInteger(co_flags.toBits()); + } return super.__findattr_ex__(name); } Modified: trunk/jython/src/org/python/core/PyUnicode.java =================================================================== --- trunk/jython/src/org/python/core/PyUnicode.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/core/PyUnicode.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -78,11 +78,11 @@ return buffer; } - PyUnicode(Iterator<Integer> iter) { + public PyUnicode(Iterator<Integer> iter) { this(fromCodePoints(iter)); } - PyUnicode(Collection<Integer> ucs4) { + public PyUnicode(Collection<Integer> ucs4) { this(ucs4.iterator()); } Modified: trunk/jython/src/org/python/core/__builtin__.java =================================================================== --- trunk/jython/src/org/python/core/__builtin__.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/core/__builtin__.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -1526,7 +1526,7 @@ public static PyObject compile(PyObject source, String filename, String mode, int flags, boolean dont_inherit) { - if ((flags & ~PyTableCode.CO_ALL_FEATURES) != 0) { + if ((flags & ~PyBaseCode.CO_ALL_FEATURES) != 0) { throw Py.ValueError("compile(): unrecognised flags"); } if (!mode.equals("exec") && !mode.equals("eval") && !mode.equals("single")) { @@ -1542,12 +1542,31 @@ throw Py.TypeError("expected a readable buffer object"); } if (source instanceof PyUnicode) { - flags |= PyTableCode.PyCF_SOURCE_IS_UTF8; + flags |= PyBaseCode.PyCF_SOURCE_IS_UTF8; } return Py.compile_flags(((PyString)source).toString(), filename, mode, Py.getCompilerFlags(flags, dont_inherit)); } + public static PyObject compile(PyObject source, String filename, String mode, CompilerFlags flags, + boolean dont_inherit) { + if (!mode.equals("exec") && !mode.equals("eval") && !mode.equals("single")) { + throw Py.ValueError("compile() arg 3 must be 'exec' or 'eval' or 'single'"); + } + + mod ast = py2node(source); + if (ast != null) { + return Py.compile_flags(ast, filename, mode, Py.getCompilerFlags(flags, dont_inherit)); + } + + if (!(source instanceof PyString)) { + throw Py.TypeError("expected a readable buffer object"); + } + flags.source_is_utf8 = source instanceof PyUnicode; + return Py.compile_flags(((PyString)source).toString(), filename, mode, + Py.getCompilerFlags(flags, dont_inherit)); + } + /** * @returns mod if obj is a wrapper around an AST mod else returns * null Modified: trunk/jython/src/org/python/modules/_marshal.java =================================================================== --- trunk/jython/src/org/python/modules/_marshal.java 2009-03-06 22:18:24 UTC (rev 6077) +++ trunk/jython/src/org/python/modules/_marshal.java 2009-03-07 04:05:04 UTC (rev 6078) @@ -226,7 +226,7 @@ write_int(code.co_argcount); write_int(code.co_nlocals); write_int(code.co_stacksize); - write_int(code.co_flags); + write_int(code.co_flags.toBits()); write_object(Py.newString(new String(code.co_code)), depth + 1); write_object(new PyTuple(code.co_consts), depth + 1); write_strings(code.co_names, depth + 1); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2009-03-06 22:18:35
|
Revision: 6077 http://jython.svn.sourceforge.net/jython/?rev=6077&view=rev Author: otmarhumbel Date: 2009-03-06 22:18:24 +0000 (Fri, 06 Mar 2009) Log Message: ----------- also unset _BOOT_CP (for symmetry) Modified Paths: -------------- trunk/jython/src/shell/jython.bat Modified: trunk/jython/src/shell/jython.bat =================================================================== --- trunk/jython/src/shell/jython.bat 2009-03-06 21:56:19 UTC (rev 6076) +++ trunk/jython/src/shell/jython.bat 2009-03-06 22:18:24 UTC (rev 6077) @@ -170,6 +170,7 @@ set _CMP1= set _CMP2= set _CP= +set _BOOT_CP= set _JAVA_CMD= set _JAVA_OPTS= set _JAVA_STACK= This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <otm...@us...> - 2009-03-06 21:56:31
|
Revision: 6076 http://jython.svn.sourceforge.net/jython/?rev=6076&view=rev Author: otmarhumbel Date: 2009-03-06 21:56:19 +0000 (Fri, 06 Mar 2009) Log Message: ----------- make byte code verification the default again: - drop option --verify - new option --boot Modified Paths: -------------- trunk/jython/src/shell/jython trunk/jython/src/shell/jython.bat Modified: trunk/jython/src/shell/jython =================================================================== --- trunk/jython/src/shell/jython 2009-03-06 18:27:15 UTC (rev 6075) +++ trunk/jython/src/shell/jython 2009-03-06 21:56:19 UTC (rev 6076) @@ -142,9 +142,9 @@ java_args=("${java_args[@]}" -javaagent:"$agent_path" -Dprofile.properties="$props_path") ;; - # Don't put Jython on the boot classpath (enables the verifier) - --verify) - verify_requested=true + # Put Jython on the boot classpath (disables the verifier) + --boot) + boot_requested=true ;; # Run under JDB --jdb) @@ -197,7 +197,7 @@ fi fi -if [ -n "$profile_requested" -o -n "$verify_requested" ] ; then +if [ -n "$profile_requested" -o -z "$boot_requested" ] ; then [ -n "$profile_requested" ] && echo "Running with instrumented profiler" java_args=("${java_args[@]}" -classpath "$CP$CP_DELIMITER$CLASSPATH") else @@ -224,7 +224,7 @@ echo "--jdb : run under JDB" >&2 echo "--print : print the Java command instead of executing it" >&2 echo "--profile: run with the Java Interactive Profiler (http://jiprof.sf.net)" >&2 - echo "--verify : enable bytecode verifier for Jython classes (for development)" >&2 + echo "--boot : put jython on the boot classpath (disables the bytecode verifier)" >&2 echo "-- : pass remaining arguments through to Jython" >&2 echo "Jython launcher environment variables:" >&2 echo "JAVA_HOME : Java installation directory" >&2 Modified: trunk/jython/src/shell/jython.bat =================================================================== --- trunk/jython/src/shell/jython.bat 2009-03-06 18:27:15 UTC (rev 6075) +++ trunk/jython/src/shell/jython.bat 2009-03-06 21:56:19 UTC (rev 6076) @@ -121,9 +121,8 @@ goto :nextArg ) -if ["%_CMP%"] == ["--verify"] ( - set CLASSPATH=%_CP:"=%;%CLASSPATH:"=% - set _CP= +if ["%_CMP%"] == ["--boot"] ( + set _BOOT_CP=-Xbootclasspath/a:%_CP% goto :nextArg ) @@ -161,7 +160,8 @@ goto scanArgs :argsDone -%_JAVA_CMD% %_JAVA_OPTS% %_JAVA_STACK% -Xbootclasspath/a:%_CP% -Dpython.home=%_JYTHON_HOME% -Dpython.executable="%~f0" -classpath "%CLASSPATH%" org.python.util.jython %_JYTHON_OPTS% %_JYTHON_ARGS% %_ARGS% +if not defined _BOOT_CP set CLASSPATH=%_CP:"=%;%CLASSPATH:"=% +%_JAVA_CMD% %_JAVA_OPTS% %_JAVA_STACK% %_BOOT_CP% -Dpython.home=%_JYTHON_HOME% -Dpython.executable="%~f0" -classpath "%CLASSPATH%" org.python.util.jython %_JYTHON_OPTS% %_JYTHON_ARGS% %_ARGS% set E=%ERRORLEVEL% :cleanup This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-06 18:27:27
|
Revision: 6075 http://jython.svn.sourceforge.net/jython/?rev=6075&view=rev Author: fwierzbicki Date: 2009-03-06 18:27:15 +0000 (Fri, 06 Mar 2009) Log Message: ----------- Merged revisions 5751,6066-6070 via svnmerge from https://jython.svn.sourceforge.net/svnroot/jython/branches/modjy Merging Alan Kennedy's amazing modjy project http://modjy.xhaus.com/ into core of Jython Cut the branch comments down to the interesting ones. Thanks Alan! ........ r6068 | amak | 2009-03-05 10:43:01 -0500 (Thu, 05 Mar 2009) | 1 line Modification to the ModjyJServlet to reflect that it is now part of the jython distribution, rather than a standalone product. ........ r6069 | amak | 2009-03-05 10:54:43 -0500 (Thu, 05 Mar 2009) | 3 lines Adding the original modjy demo application to the Demo subdirectory. This application gives the users a complete running application that they can use as a template for aplication development. In the future, we might develop a more sophisticated application. ........ r6070 | amak | 2009-03-05 17:07:35 -0500 (Thu, 05 Mar 2009) | 1 line Committing the unit tests. There is a readme.txt file in the directory which explains how to run the tests, which depend on mockrunner. ........ Added Paths: ----------- trunk/jython/Demo/modjy_webapp/ trunk/jython/Demo/modjy_webapp/WEB-INF/ trunk/jython/Demo/modjy_webapp/WEB-INF/lib/ trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/ trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt trunk/jython/Demo/modjy_webapp/WEB-INF/web.xml trunk/jython/Demo/modjy_webapp/demo_app.py trunk/jython/Demo/modjy_webapp/readme.txt trunk/jython/Lib/modjy/ trunk/jython/Lib/modjy/__init__.py trunk/jython/Lib/modjy/modjy.py trunk/jython/Lib/modjy/modjy_exceptions.py trunk/jython/Lib/modjy/modjy_impl.py trunk/jython/Lib/modjy/modjy_log.py trunk/jython/Lib/modjy/modjy_params.py trunk/jython/Lib/modjy/modjy_publish.py trunk/jython/Lib/modjy/modjy_response.py trunk/jython/Lib/modjy/modjy_write.py trunk/jython/Lib/modjy/modjy_wsgi.py trunk/jython/src/com/xhaus/ trunk/jython/src/com/xhaus/modjy/ trunk/jython/src/com/xhaus/modjy/ModjyJServlet.java trunk/jython/tests/modjy/ trunk/jython/tests/modjy/__init__.py trunk/jython/tests/modjy/build.xml trunk/jython/tests/modjy/empty.txt trunk/jython/tests/modjy/java/ trunk/jython/tests/modjy/java/com/ trunk/jython/tests/modjy/java/com/xhaus/ trunk/jython/tests/modjy/java/com/xhaus/modjy/ trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestAppInvocation.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestBase.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestContentHeaders.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestEnviron.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestHeaders.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestReturnIterable.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestWSGIStreams.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestWebInf.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestWriteCallable.java trunk/jython/tests/modjy/lib_python_folder/ trunk/jython/tests/modjy/lib_python_folder/__init__.py trunk/jython/tests/modjy/lib_python_folder/add_zips.pth trunk/jython/tests/modjy/lib_python_folder/do_import.pth trunk/jython/tests/modjy/lib_python_folder/mock_framework/ trunk/jython/tests/modjy/lib_python_folder/mock_framework/__init__.py trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/ trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/__init__.py trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/handlers/ trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/handlers/__init__.py trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/handlers/wsgi_handlers.py trunk/jython/tests/modjy/lib_python_folder/script_name_path_info.py trunk/jython/tests/modjy/lib_python_folder/test_lib/ trunk/jython/tests/modjy/lib_python_folder/test_lib/__init__.py trunk/jython/tests/modjy/lib_python_folder/test_lib/some_libs.py trunk/jython/tests/modjy/lib_python_folder/test_modules.zip trunk/jython/tests/modjy/lines.txt trunk/jython/tests/modjy/readme.txt trunk/jython/tests/modjy/test_apps_dir/ trunk/jython/tests/modjy/test_apps_dir/__init__.py trunk/jython/tests/modjy/test_apps_dir/content_header_tests.py trunk/jython/tests/modjy/test_apps_dir/environ_tests.py trunk/jython/tests/modjy/test_apps_dir/header_tests.py trunk/jython/tests/modjy/test_apps_dir/return_tests.py trunk/jython/tests/modjy/test_apps_dir/simple_app.py trunk/jython/tests/modjy/test_apps_dir/stream_tests.py trunk/jython/tests/modjy/test_apps_dir/web_inf_tests.py Removed Paths: ------------- trunk/jython/Demo/modjy_webapp/WEB-INF/ trunk/jython/Demo/modjy_webapp/WEB-INF/lib/ trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/ trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt trunk/jython/Demo/modjy_webapp/WEB-INF/web.xml trunk/jython/Demo/modjy_webapp/demo_app.py trunk/jython/Demo/modjy_webapp/readme.txt trunk/jython/Lib/modjy/__init__.py trunk/jython/Lib/modjy/modjy.py trunk/jython/Lib/modjy/modjy_exceptions.py trunk/jython/Lib/modjy/modjy_impl.py trunk/jython/Lib/modjy/modjy_log.py trunk/jython/Lib/modjy/modjy_params.py trunk/jython/Lib/modjy/modjy_publish.py trunk/jython/Lib/modjy/modjy_response.py trunk/jython/Lib/modjy/modjy_write.py trunk/jython/Lib/modjy/modjy_wsgi.py trunk/jython/src/com/xhaus/modjy/ trunk/jython/src/com/xhaus/modjy/ModjyJServlet.java trunk/jython/tests/modjy/__init__.py trunk/jython/tests/modjy/build.xml trunk/jython/tests/modjy/empty.txt trunk/jython/tests/modjy/java/ trunk/jython/tests/modjy/java/com/ trunk/jython/tests/modjy/java/com/xhaus/ trunk/jython/tests/modjy/java/com/xhaus/modjy/ trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestAppInvocation.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestBase.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestContentHeaders.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestEnviron.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestHeaders.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestReturnIterable.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestWSGIStreams.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestWebInf.java trunk/jython/tests/modjy/java/com/xhaus/modjy/ModjyTestWriteCallable.java trunk/jython/tests/modjy/lib_python_folder/ trunk/jython/tests/modjy/lib_python_folder/__init__.py trunk/jython/tests/modjy/lib_python_folder/add_zips.pth trunk/jython/tests/modjy/lib_python_folder/do_import.pth trunk/jython/tests/modjy/lib_python_folder/mock_framework/ trunk/jython/tests/modjy/lib_python_folder/mock_framework/__init__.py trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/ trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/__init__.py trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/handlers/ trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/handlers/__init__.py trunk/jython/tests/modjy/lib_python_folder/mock_framework/web/handlers/wsgi_handlers.py trunk/jython/tests/modjy/lib_python_folder/script_name_path_info.py trunk/jython/tests/modjy/lib_python_folder/test_lib/ trunk/jython/tests/modjy/lib_python_folder/test_lib/__init__.py trunk/jython/tests/modjy/lib_python_folder/test_lib/some_libs.py trunk/jython/tests/modjy/lib_python_folder/test_modules.zip trunk/jython/tests/modjy/lines.txt trunk/jython/tests/modjy/readme.txt trunk/jython/tests/modjy/test_apps_dir/ trunk/jython/tests/modjy/test_apps_dir/__init__.py trunk/jython/tests/modjy/test_apps_dir/content_header_tests.py trunk/jython/tests/modjy/test_apps_dir/environ_tests.py trunk/jython/tests/modjy/test_apps_dir/header_tests.py trunk/jython/tests/modjy/test_apps_dir/return_tests.py trunk/jython/tests/modjy/test_apps_dir/simple_app.py trunk/jython/tests/modjy/test_apps_dir/stream_tests.py trunk/jython/tests/modjy/test_apps_dir/web_inf_tests.py Property Changed: ---------------- trunk/jython/ Property changes on: trunk/jython ___________________________________________________________________ Modified: svnmerge-integrated - /branches/modjy:1-5750 /branches/pbcvm:1-6045 + /branches/modjy:1-6074 /branches/pbcvm:1-6045 Deleted: trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt =================================================================== --- branches/modjy/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,11 +0,0 @@ -The WEB-INF/lib-python directory, if it exists, is automatically added -to sys.path. Adding jython modules into this directory will make them -available for import into your application. - -If you add your modules in a subdirectory, then be sure that that -subdirectory contains an __init__.py file, so that the subdirectory -is considered to be a package. - -See here for more details. -http://www.rexx.com/~dkuhlman/python_101/python_101.html#SECTION004540000000000000000 -http://www.python.org/doc/essays/packages.html Copied: trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt (from rev 6070, branches/modjy/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt) =================================================================== --- trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt (rev 0) +++ trunk/jython/Demo/modjy_webapp/WEB-INF/lib-python/readme.txt 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,11 @@ +The WEB-INF/lib-python directory, if it exists, is automatically added +to sys.path. Adding jython modules into this directory will make them +available for import into your application. + +If you add your modules in a subdirectory, then be sure that that +subdirectory contains an __init__.py file, so that the subdirectory +is considered to be a package. + +See here for more details. +http://www.rexx.com/~dkuhlman/python_101/python_101.html#SECTION004540000000000000000 +http://www.python.org/doc/essays/packages.html Deleted: trunk/jython/Demo/modjy_webapp/WEB-INF/web.xml =================================================================== --- branches/modjy/Demo/modjy_webapp/WEB-INF/web.xml 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Demo/modjy_webapp/WEB-INF/web.xml 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,85 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE web-app - PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" - "http://java.sun.com/dtd/web-app_2_3.dtd"> -<web-app> - - <display-name>modjy demo application</display-name> - <description> - modjy WSGI demo application - </description> - - <servlet> - <servlet-name>modjy</servlet-name> - <servlet-class>com.xhaus.modjy.ModjyJServlet</servlet-class> - <init-param> - <param-name>python.home</param-name> - <param-value>C:/jython2.5</param-value> - </init-param> -<!-- - There are two different ways you can specify an application to modjy - 1. Using the app_import_name mechanism - 2. Using a combination of app_directory/app_filename/app_callable_name - Examples of both are given below - See the documenation for more details. - http://modjy.xhaus.com/locating.html#locating_callables ---> -<!-- - This is the app_import_name mechanism. If you specify a value - for this variable, then it will take precedence over the other mechanism - <init-param> - <param-name>app_import_name</param-name> - <param-value>my_wsgi_module.my_handler_class().handler_method</param-value> - </init-param> ---> -<!-- - And this is the app_directory/app_filename/app_callable_name combo - The defaults for these three variables are ""/application.py/handler - So if you specify no values at all for any of app_* variables, then modjy - will by default look for "handler" in "application.py" in the servlet - context root. - <init-param> - <param-name>app_directory</param-name> - <param-value>some_sub_directory</param-value> - </init-param> ---> - <init-param> - <param-name>app_filename</param-name> - <param-value>demo_app.py</param-value> - </init-param> -<!-- - Supply a value for this parameter if you want your application - callable to have a different name than the default. - <init-param> - <param-name>app_callable_name</param-name> - <param-value>my_handler_func</param-value> - </init-param> ---> - <!-- Do you want application callables to be cached? --> - <init-param> - <param-name>cache_callables</param-name> - <param-value>1</param-value> - </init-param> - <!-- Should the application be reloaded if it's .py file changes? --> - <!-- Does not work with the app_import_name mechanism --> - <init-param> - <param-name>reload_on_mod</param-name> - <param-value>1</param-value> - </init-param> - <init-param> - <param-name>log_level</param-name> - <param-value>debug</param-value> -<!-- <param-value>info</param-value> --> -<!-- <param-value>warn</param-value> --> -<!-- <param-value>error</param-value> --> -<!-- <param-value>fatal</param-value> --> - </init-param> - <load-on-startup>1</load-on-startup> - </servlet> - - <servlet-mapping> - <servlet-name>modjy</servlet-name> - <url-pattern>/*</url-pattern> - </servlet-mapping> - -</web-app> Copied: trunk/jython/Demo/modjy_webapp/WEB-INF/web.xml (from rev 6070, branches/modjy/Demo/modjy_webapp/WEB-INF/web.xml) =================================================================== --- trunk/jython/Demo/modjy_webapp/WEB-INF/web.xml (rev 0) +++ trunk/jython/Demo/modjy_webapp/WEB-INF/web.xml 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,85 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!DOCTYPE web-app + PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" + "http://java.sun.com/dtd/web-app_2_3.dtd"> +<web-app> + + <display-name>modjy demo application</display-name> + <description> + modjy WSGI demo application + </description> + + <servlet> + <servlet-name>modjy</servlet-name> + <servlet-class>com.xhaus.modjy.ModjyJServlet</servlet-class> + <init-param> + <param-name>python.home</param-name> + <param-value>C:/jython2.5</param-value> + </init-param> +<!-- + There are two different ways you can specify an application to modjy + 1. Using the app_import_name mechanism + 2. Using a combination of app_directory/app_filename/app_callable_name + Examples of both are given below + See the documenation for more details. + http://modjy.xhaus.com/locating.html#locating_callables +--> +<!-- + This is the app_import_name mechanism. If you specify a value + for this variable, then it will take precedence over the other mechanism + <init-param> + <param-name>app_import_name</param-name> + <param-value>my_wsgi_module.my_handler_class().handler_method</param-value> + </init-param> +--> +<!-- + And this is the app_directory/app_filename/app_callable_name combo + The defaults for these three variables are ""/application.py/handler + So if you specify no values at all for any of app_* variables, then modjy + will by default look for "handler" in "application.py" in the servlet + context root. + <init-param> + <param-name>app_directory</param-name> + <param-value>some_sub_directory</param-value> + </init-param> +--> + <init-param> + <param-name>app_filename</param-name> + <param-value>demo_app.py</param-value> + </init-param> +<!-- + Supply a value for this parameter if you want your application + callable to have a different name than the default. + <init-param> + <param-name>app_callable_name</param-name> + <param-value>my_handler_func</param-value> + </init-param> +--> + <!-- Do you want application callables to be cached? --> + <init-param> + <param-name>cache_callables</param-name> + <param-value>1</param-value> + </init-param> + <!-- Should the application be reloaded if it's .py file changes? --> + <!-- Does not work with the app_import_name mechanism --> + <init-param> + <param-name>reload_on_mod</param-name> + <param-value>1</param-value> + </init-param> + <init-param> + <param-name>log_level</param-name> + <param-value>debug</param-value> +<!-- <param-value>info</param-value> --> +<!-- <param-value>warn</param-value> --> +<!-- <param-value>error</param-value> --> +<!-- <param-value>fatal</param-value> --> + </init-param> + <load-on-startup>1</load-on-startup> + </servlet> + + <servlet-mapping> + <servlet-name>modjy</servlet-name> + <url-pattern>/*</url-pattern> + </servlet-mapping> + +</web-app> Deleted: trunk/jython/Demo/modjy_webapp/demo_app.py =================================================================== --- branches/modjy/Demo/modjy_webapp/demo_app.py 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Demo/modjy_webapp/demo_app.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,37 +0,0 @@ -import sys - -def escape_html(s): return s.replace('&', '&').replace('<', '<').replace('>', '>') - -def cutoff(s, n=100): - if len(s) > n: return s[:n]+ '.. cut ..' - return s - -def handler(environ, start_response): - writer = start_response("200 OK", [ ('content-type', 'text/html') ]) - response_parts = [] - response_parts.append("<html>") - response_parts.append("<head>") - response_parts.append("<title>Modjy demo application</title>") - response_parts.append("</head>") - response_parts.append("<body>") - response_parts.append("<p>Modjy servlet running correctly: jython %s on %s:</p>" % (sys.version, sys.platform)) - response_parts.append("<h3>Hello WSGI World!</h3>") - response_parts.append("<h4>Here are the contents of the WSGI environment</h4>") - environ_str = "<table border='1'>" - keys = environ.keys() - keys.sort() - for ix, name in enumerate(keys): - if ix % 2: - background='#ffffff' - else: - background='#eeeeee' - style = " style='background-color:%s;'" % background - value = escape_html(cutoff(str(environ[name]))) or ' ' - environ_str = "%s\n<tr><td%s>%s</td><td%s>%s</td></tr>" % \ - (environ_str, style, name, style, value) - environ_str = "%s\n</table>" % environ_str - response_parts.append(environ_str) - response_parts.append("</body>") - response_parts.append("</html>") - response_text = "\n".join(response_parts) - return [response_text] Copied: trunk/jython/Demo/modjy_webapp/demo_app.py (from rev 6070, branches/modjy/Demo/modjy_webapp/demo_app.py) =================================================================== --- trunk/jython/Demo/modjy_webapp/demo_app.py (rev 0) +++ trunk/jython/Demo/modjy_webapp/demo_app.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,37 @@ +import sys + +def escape_html(s): return s.replace('&', '&').replace('<', '<').replace('>', '>') + +def cutoff(s, n=100): + if len(s) > n: return s[:n]+ '.. cut ..' + return s + +def handler(environ, start_response): + writer = start_response("200 OK", [ ('content-type', 'text/html') ]) + response_parts = [] + response_parts.append("<html>") + response_parts.append("<head>") + response_parts.append("<title>Modjy demo application</title>") + response_parts.append("</head>") + response_parts.append("<body>") + response_parts.append("<p>Modjy servlet running correctly: jython %s on %s:</p>" % (sys.version, sys.platform)) + response_parts.append("<h3>Hello WSGI World!</h3>") + response_parts.append("<h4>Here are the contents of the WSGI environment</h4>") + environ_str = "<table border='1'>" + keys = environ.keys() + keys.sort() + for ix, name in enumerate(keys): + if ix % 2: + background='#ffffff' + else: + background='#eeeeee' + style = " style='background-color:%s;'" % background + value = escape_html(cutoff(str(environ[name]))) or ' ' + environ_str = "%s\n<tr><td%s>%s</td><td%s>%s</td></tr>" % \ + (environ_str, style, name, style, value) + environ_str = "%s\n</table>" % environ_str + response_parts.append(environ_str) + response_parts.append("</body>") + response_parts.append("</html>") + response_text = "\n".join(response_parts) + return [response_text] Deleted: trunk/jython/Demo/modjy_webapp/readme.txt =================================================================== --- branches/modjy/Demo/modjy_webapp/readme.txt 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Demo/modjy_webapp/readme.txt 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,15 +0,0 @@ -To deploy this application - -1. Copy the jython.jar file into the WEB-INF/lib subdirectory -2. Set the value of python.home property in WEB-INF/web.xml so - that it points to your jython installation. -3. Copy this directory to the applications directory of your servlet - container. On Apache Tomcat, this is the "webapps" subdirectory - of the tomcat install directory. -4. Enter the URL http://localhost:8080/modjy_webapp into your - browser. -5. You should see a table containing the WSGI environment. - -Please see the installation documentation for more details. - -http://modjy.xhaus.com/install.html Copied: trunk/jython/Demo/modjy_webapp/readme.txt (from rev 6070, branches/modjy/Demo/modjy_webapp/readme.txt) =================================================================== --- trunk/jython/Demo/modjy_webapp/readme.txt (rev 0) +++ trunk/jython/Demo/modjy_webapp/readme.txt 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,15 @@ +To deploy this application + +1. Copy the jython.jar file into the WEB-INF/lib subdirectory +2. Set the value of python.home property in WEB-INF/web.xml so + that it points to your jython installation. +3. Copy this directory to the applications directory of your servlet + container. On Apache Tomcat, this is the "webapps" subdirectory + of the tomcat install directory. +4. Enter the URL http://localhost:8080/modjy_webapp into your + browser. +5. You should see a table containing the WSGI environment. + +Please see the installation documentation for more details. + +http://modjy.xhaus.com/install.html Deleted: trunk/jython/Lib/modjy/__init__.py =================================================================== --- branches/modjy/Lib/modjy/__init__.py 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Lib/modjy/__init__.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,22 +0,0 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -__all__ = ['modjy', 'modjy_exceptions', 'modjy_impl', 'modjy_log', 'modjy_params', 'modjy_publish', 'modjy_response', 'modjy_write', 'modjy_wsgi',] - Copied: trunk/jython/Lib/modjy/__init__.py (from rev 6070, branches/modjy/Lib/modjy/__init__.py) =================================================================== --- trunk/jython/Lib/modjy/__init__.py (rev 0) +++ trunk/jython/Lib/modjy/__init__.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,22 @@ +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +__all__ = ['modjy', 'modjy_exceptions', 'modjy_impl', 'modjy_log', 'modjy_params', 'modjy_publish', 'modjy_response', 'modjy_write', 'modjy_wsgi',] + Deleted: trunk/jython/Lib/modjy/modjy.py =================================================================== --- branches/modjy/Lib/modjy/modjy.py 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Lib/modjy/modjy.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,121 +0,0 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -import jarray -import synchronize -import sys -import types - -sys.add_package("javax.servlet") -sys.add_package("javax.servlet.http") -sys.add_package("org.python.core") - -from modjy_exceptions import * -from modjy_log import * -from modjy_params import modjy_param_mgr, modjy_servlet_params -from modjy_wsgi import modjy_wsgi -from modjy_response import start_response_object -from modjy_impl import modjy_impl -from modjy_publish import modjy_publisher - -from javax.servlet.http import HttpServlet - -class modjy_servlet(HttpServlet, modjy_publisher, modjy_wsgi, modjy_impl): - - def __init__(self): - HttpServlet.__init__(self) - - def do_param(self, name, value): - if name[:3] == 'log': - getattr(self.log, "set_%s" % name)(value) - else: - self.params[name] = value - - def process_param_container(self, param_container): - param_enum = param_container.getInitParameterNames() - while param_enum.hasMoreElements(): - param_name = param_enum.nextElement() - self.do_param(param_name, param_container.getInitParameter(param_name)) - - def get_params(self): - self.process_param_container(self.servlet_context) - self.process_param_container(self.servlet) - - def init(self, delegator): - self.servlet = delegator - self.servlet_context = self.servlet.getServletContext() - self.servlet_config = self.servlet.getServletConfig() - self.log = modjy_logger(self.servlet_context) - self.params = modjy_param_mgr(modjy_servlet_params) - self.get_params() - self.init_impl() - self.init_publisher() - import modjy_exceptions - self.exc_handler = getattr(modjy_exceptions, '%s_handler' % self.params['exc_handler'])() - - def service (self, req, resp): - wsgi_environ = {} - try: - self.dispatch_to_application(req, resp, wsgi_environ) - except ModjyException, mx: - self.log.error("Exception servicing request: %s" % str(mx)) - typ, value, tb = sys.exc_info()[:] - self.exc_handler.handle(req, resp, wsgi_environ, mx, (typ, value, tb) ) - - def get_j2ee_ns(self, req, resp): - return { - 'servlet': self.servlet, - 'servlet_context': self.servlet_context, - 'servlet_config': self.servlet_config, - 'request': req, - 'response': resp, - } - - def dispatch_to_application(self, req, resp, environ): - app_callable = self.get_app_object(req, environ) - self.set_wsgi_environment(req, resp, environ, self.params, self.get_j2ee_ns(req, resp)) - response_callable = start_response_object(req, resp) - try: - app_return = self.call_application(app_callable, environ, response_callable) - if app_return is None: - raise ReturnNotIterable("Application returned None: must return an iterable") - self.deal_with_app_return(environ, response_callable, app_return) - except ModjyException, mx: - self.raise_exc(mx.__class__, str(mx)) - except Exception, x: - self.raise_exc(ApplicationException, str(x)) - - def call_application(self, app_callable, environ, response_callable): - if self.params['multithread']: - return app_callable.__call__(environ, response_callable) - else: - return synchronize.apply_synchronized( \ - app_callable, \ - app_callable, \ - (environ, response_callable)) - - def expand_relative_path(self, path): - if path.startswith("$"): - return self.servlet.getServletContext().getRealPath(path[1:]) - return path - - def raise_exc(self, exc_class, message): - self.log.error(message) - raise exc_class(message) Copied: trunk/jython/Lib/modjy/modjy.py (from rev 6070, branches/modjy/Lib/modjy/modjy.py) =================================================================== --- trunk/jython/Lib/modjy/modjy.py (rev 0) +++ trunk/jython/Lib/modjy/modjy.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,121 @@ +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +import jarray +import synchronize +import sys +import types + +sys.add_package("javax.servlet") +sys.add_package("javax.servlet.http") +sys.add_package("org.python.core") + +from modjy_exceptions import * +from modjy_log import * +from modjy_params import modjy_param_mgr, modjy_servlet_params +from modjy_wsgi import modjy_wsgi +from modjy_response import start_response_object +from modjy_impl import modjy_impl +from modjy_publish import modjy_publisher + +from javax.servlet.http import HttpServlet + +class modjy_servlet(HttpServlet, modjy_publisher, modjy_wsgi, modjy_impl): + + def __init__(self): + HttpServlet.__init__(self) + + def do_param(self, name, value): + if name[:3] == 'log': + getattr(self.log, "set_%s" % name)(value) + else: + self.params[name] = value + + def process_param_container(self, param_container): + param_enum = param_container.getInitParameterNames() + while param_enum.hasMoreElements(): + param_name = param_enum.nextElement() + self.do_param(param_name, param_container.getInitParameter(param_name)) + + def get_params(self): + self.process_param_container(self.servlet_context) + self.process_param_container(self.servlet) + + def init(self, delegator): + self.servlet = delegator + self.servlet_context = self.servlet.getServletContext() + self.servlet_config = self.servlet.getServletConfig() + self.log = modjy_logger(self.servlet_context) + self.params = modjy_param_mgr(modjy_servlet_params) + self.get_params() + self.init_impl() + self.init_publisher() + import modjy_exceptions + self.exc_handler = getattr(modjy_exceptions, '%s_handler' % self.params['exc_handler'])() + + def service (self, req, resp): + wsgi_environ = {} + try: + self.dispatch_to_application(req, resp, wsgi_environ) + except ModjyException, mx: + self.log.error("Exception servicing request: %s" % str(mx)) + typ, value, tb = sys.exc_info()[:] + self.exc_handler.handle(req, resp, wsgi_environ, mx, (typ, value, tb) ) + + def get_j2ee_ns(self, req, resp): + return { + 'servlet': self.servlet, + 'servlet_context': self.servlet_context, + 'servlet_config': self.servlet_config, + 'request': req, + 'response': resp, + } + + def dispatch_to_application(self, req, resp, environ): + app_callable = self.get_app_object(req, environ) + self.set_wsgi_environment(req, resp, environ, self.params, self.get_j2ee_ns(req, resp)) + response_callable = start_response_object(req, resp) + try: + app_return = self.call_application(app_callable, environ, response_callable) + if app_return is None: + raise ReturnNotIterable("Application returned None: must return an iterable") + self.deal_with_app_return(environ, response_callable, app_return) + except ModjyException, mx: + self.raise_exc(mx.__class__, str(mx)) + except Exception, x: + self.raise_exc(ApplicationException, str(x)) + + def call_application(self, app_callable, environ, response_callable): + if self.params['multithread']: + return app_callable.__call__(environ, response_callable) + else: + return synchronize.apply_synchronized( \ + app_callable, \ + app_callable, \ + (environ, response_callable)) + + def expand_relative_path(self, path): + if path.startswith("$"): + return self.servlet.getServletContext().getRealPath(path[1:]) + return path + + def raise_exc(self, exc_class, message): + self.log.error(message) + raise exc_class(message) Deleted: trunk/jython/Lib/modjy/modjy_exceptions.py =================================================================== --- branches/modjy/Lib/modjy/modjy_exceptions.py 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Lib/modjy/modjy_exceptions.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,91 +0,0 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -import sys -import StringIO -import traceback - -from java.lang import IllegalStateException -from java.io import IOException -from javax.servlet import ServletException - -class ModjyException(Exception): pass - -class ModjyIOException(ModjyException): pass - -class ConfigException(ModjyException): pass -class BadParameter(ConfigException): pass -class ApplicationNotFound(ConfigException): pass -class NoCallable(ConfigException): pass - -class RequestException(ModjyException): pass - -class ApplicationException(ModjyException): pass -class StartResponseNotCalled(ApplicationException): pass -class StartResponseCalledTwice(ApplicationException): pass -class ResponseCommitted(ApplicationException): pass -class HopByHopHeaderSet(ApplicationException): pass -class WrongLength(ApplicationException): pass -class BadArgument(ApplicationException): pass -class ReturnNotIterable(ApplicationException): pass -class NonStringOutput(ApplicationException): pass - -class exception_handler: - - def handle(self, req, resp, environ, exc, exc_info): - pass - - def get_status_and_message(self, req, resp, exc): - return resp.SC_INTERNAL_SERVER_ERROR, "Server configuration error" - -# -# Special exception handler for testing -# - -class testing_handler(exception_handler): - - def handle(self, req, resp, environ, exc, exc_info): - typ, value, tb = exc_info - err_msg = StringIO.StringIO() - err_msg.write("%s: %s\n" % (typ, value,) ) - err_msg.write(">Environment\n") - for k in environ.keys(): - err_msg.write("%s=%s\n" % (k, repr(environ[k])) ) - err_msg.write("<Environment\n") - err_msg.write(">TraceBack\n") - for line in traceback.format_exception(typ, value, tb): - err_msg.write(line) - err_msg.write("<TraceBack\n") - try: - status, message = self.get_status_and_message(req, resp, exc) - resp.setStatus(status) - resp.setContentLength(len(err_msg.getvalue())) - resp.getOutputStream().write(err_msg.getvalue()) - except IllegalStateException, ise: - raise exc # Let the container deal with it - -# -# Standard exception handler -# - -class standard_handler(exception_handler): - - def handle(self, req, resp, environ, exc, exc_info): - raise exc_info[0], exc_info[1], exc_info[2] Copied: trunk/jython/Lib/modjy/modjy_exceptions.py (from rev 6070, branches/modjy/Lib/modjy/modjy_exceptions.py) =================================================================== --- trunk/jython/Lib/modjy/modjy_exceptions.py (rev 0) +++ trunk/jython/Lib/modjy/modjy_exceptions.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,91 @@ +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +import sys +import StringIO +import traceback + +from java.lang import IllegalStateException +from java.io import IOException +from javax.servlet import ServletException + +class ModjyException(Exception): pass + +class ModjyIOException(ModjyException): pass + +class ConfigException(ModjyException): pass +class BadParameter(ConfigException): pass +class ApplicationNotFound(ConfigException): pass +class NoCallable(ConfigException): pass + +class RequestException(ModjyException): pass + +class ApplicationException(ModjyException): pass +class StartResponseNotCalled(ApplicationException): pass +class StartResponseCalledTwice(ApplicationException): pass +class ResponseCommitted(ApplicationException): pass +class HopByHopHeaderSet(ApplicationException): pass +class WrongLength(ApplicationException): pass +class BadArgument(ApplicationException): pass +class ReturnNotIterable(ApplicationException): pass +class NonStringOutput(ApplicationException): pass + +class exception_handler: + + def handle(self, req, resp, environ, exc, exc_info): + pass + + def get_status_and_message(self, req, resp, exc): + return resp.SC_INTERNAL_SERVER_ERROR, "Server configuration error" + +# +# Special exception handler for testing +# + +class testing_handler(exception_handler): + + def handle(self, req, resp, environ, exc, exc_info): + typ, value, tb = exc_info + err_msg = StringIO.StringIO() + err_msg.write("%s: %s\n" % (typ, value,) ) + err_msg.write(">Environment\n") + for k in environ.keys(): + err_msg.write("%s=%s\n" % (k, repr(environ[k])) ) + err_msg.write("<Environment\n") + err_msg.write(">TraceBack\n") + for line in traceback.format_exception(typ, value, tb): + err_msg.write(line) + err_msg.write("<TraceBack\n") + try: + status, message = self.get_status_and_message(req, resp, exc) + resp.setStatus(status) + resp.setContentLength(len(err_msg.getvalue())) + resp.getOutputStream().write(err_msg.getvalue()) + except IllegalStateException, ise: + raise exc # Let the container deal with it + +# +# Standard exception handler +# + +class standard_handler(exception_handler): + + def handle(self, req, resp, environ, exc, exc_info): + raise exc_info[0], exc_info[1], exc_info[2] Deleted: trunk/jython/Lib/modjy/modjy_impl.py =================================================================== --- branches/modjy/Lib/modjy/modjy_impl.py 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Lib/modjy/modjy_impl.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,101 +0,0 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -import types -import sys - -from modjy_exceptions import * - -class modjy_impl: - - def deal_with_app_return(self, environ, start_response_callable, app_return): - self.log.debug("Processing app return type: %s" % str(type(app_return))) - if isinstance(app_return, types.StringTypes): - raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) - if type(app_return) is types.FileType: - pass # TBD: What to do here? can't call fileno() - if hasattr(app_return, '__len__') and callable(app_return.__len__): - expected_pieces = app_return.__len__() - else: - expected_pieces = -1 - try: - try: - ix = 0 - for next_piece in app_return: - if not isinstance(next_piece, types.StringTypes): - raise NonStringOutput("Application returned iterable containing non-strings: %s" % str(type(next_piece))) - if ix == 0: - # The application may have called start_response in the first iteration - if not start_response_callable.called: - raise StartResponseNotCalled("Start_response callable was never called.") - if not start_response_callable.content_length \ - and expected_pieces == 1 \ - and start_response_callable.write_callable.num_writes == 0: - # Take the length of the first piece - start_response_callable.set_content_length(len(next_piece)) - start_response_callable.write_callable(next_piece) - ix += 1 - if ix == expected_pieces: - break - if expected_pieces != -1 and ix != expected_pieces: - raise WrongLength("Iterator len() was wrong. Expected %d pieces: got %d" % (expected_pieces, ix) ) - except AttributeError, ax: - if str(ax) == "__getitem__": - raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) - else: - raise ax - except TypeError, tx: - raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) - except ModjyException, mx: - raise mx - except Exception, x: - raise ApplicationException(x) - finally: - if hasattr(app_return, 'close') and callable(app_return.close): - app_return.close() - - def init_impl(self): - self.do_j_env_params() - - def add_packages(self, package_list): - packages = [p.strip() for p in package_list.split(';')] - for p in packages: - self.log.info("Adding java package %s to jython" % p) - sys.add_package(p) - - def add_classdirs(self, classdir_list): - classdirs = [cd.strip() for cd in classdir_list.split(';')] - for cd in classdirs: - self.log.info("Adding directory %s to jython class file search path" % cd) - sys.add_classdir(cd) - - def add_extdirs(self, extdir_list): - extdirs = [ed.strip() for ed in extdir_list.split(';')] - for ed in extdirs: - self.log.info("Adding directory %s for .jars and .zips search path" % ed) - sys.add_extdir(self.expand_relative_path(ed)) - - def do_j_env_params(self): - if self.params['packages']: - self.add_packages(self.params['packages']) - if self.params['classdirs']: - self.add_classdirs(self.params['classdirs']) - if self.params['extdirs']: - self.add_extdirs(self.params['extdirs']) Copied: trunk/jython/Lib/modjy/modjy_impl.py (from rev 6070, branches/modjy/Lib/modjy/modjy_impl.py) =================================================================== --- trunk/jython/Lib/modjy/modjy_impl.py (rev 0) +++ trunk/jython/Lib/modjy/modjy_impl.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,101 @@ +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +import types +import sys + +from modjy_exceptions import * + +class modjy_impl: + + def deal_with_app_return(self, environ, start_response_callable, app_return): + self.log.debug("Processing app return type: %s" % str(type(app_return))) + if isinstance(app_return, types.StringTypes): + raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) + if type(app_return) is types.FileType: + pass # TBD: What to do here? can't call fileno() + if hasattr(app_return, '__len__') and callable(app_return.__len__): + expected_pieces = app_return.__len__() + else: + expected_pieces = -1 + try: + try: + ix = 0 + for next_piece in app_return: + if not isinstance(next_piece, types.StringTypes): + raise NonStringOutput("Application returned iterable containing non-strings: %s" % str(type(next_piece))) + if ix == 0: + # The application may have called start_response in the first iteration + if not start_response_callable.called: + raise StartResponseNotCalled("Start_response callable was never called.") + if not start_response_callable.content_length \ + and expected_pieces == 1 \ + and start_response_callable.write_callable.num_writes == 0: + # Take the length of the first piece + start_response_callable.set_content_length(len(next_piece)) + start_response_callable.write_callable(next_piece) + ix += 1 + if ix == expected_pieces: + break + if expected_pieces != -1 and ix != expected_pieces: + raise WrongLength("Iterator len() was wrong. Expected %d pieces: got %d" % (expected_pieces, ix) ) + except AttributeError, ax: + if str(ax) == "__getitem__": + raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) + else: + raise ax + except TypeError, tx: + raise ReturnNotIterable("Application returned object that was not an iterable: %s" % str(type(app_return))) + except ModjyException, mx: + raise mx + except Exception, x: + raise ApplicationException(x) + finally: + if hasattr(app_return, 'close') and callable(app_return.close): + app_return.close() + + def init_impl(self): + self.do_j_env_params() + + def add_packages(self, package_list): + packages = [p.strip() for p in package_list.split(';')] + for p in packages: + self.log.info("Adding java package %s to jython" % p) + sys.add_package(p) + + def add_classdirs(self, classdir_list): + classdirs = [cd.strip() for cd in classdir_list.split(';')] + for cd in classdirs: + self.log.info("Adding directory %s to jython class file search path" % cd) + sys.add_classdir(cd) + + def add_extdirs(self, extdir_list): + extdirs = [ed.strip() for ed in extdir_list.split(';')] + for ed in extdirs: + self.log.info("Adding directory %s for .jars and .zips search path" % ed) + sys.add_extdir(self.expand_relative_path(ed)) + + def do_j_env_params(self): + if self.params['packages']: + self.add_packages(self.params['packages']) + if self.params['classdirs']: + self.add_classdirs(self.params['classdirs']) + if self.params['extdirs']: + self.add_extdirs(self.params['extdirs']) Deleted: trunk/jython/Lib/modjy/modjy_log.py =================================================================== --- branches/modjy/Lib/modjy/modjy_log.py 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Lib/modjy/modjy_log.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,80 +0,0 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -import java - -import sys - -DEBUG = 'debug' -INFO = 'info' -WARN = 'warn' -ERROR = 'error' -FATAL = 'fatal' - -levels_dict = {} -ix = 0 -for level in [DEBUG, INFO, WARN, ERROR, FATAL, ]: - levels_dict[level]=ix - ix += 1 - -class modjy_logger: - - def __init__(self, context): - self.log_ctx = context - self.format_str = "%(lvl)s:\t%(msg)s" - self.log_level = levels_dict[DEBUG] - - def _log(self, level, level_str, msg, exc): - if level >= self.log_level: - msg = self.format_str % {'lvl': level_str, 'msg': msg, } - if exc: -# java.lang.System.err.println(msg, exc) - self.log_ctx.log(msg, exc) - else: -# java.lang.System.err.println(msg) - self.log_ctx.log(msg) - - def debug(self, msg, exc=None): - self._log(0, DEBUG, msg, exc) - - def info(self, msg, exc=None): - self._log(1, INFO, msg, exc) - - def warn(self, msg, exc=None): - self._log(2, WARN, msg, exc) - - def error(self, msg, exc=None): - self._log(3, ERROR, msg, exc) - - def fatal(self, msg, exc=None): - self._log(4, FATAL, msg, exc) - - def set_log_level(self, level_string): - try: - self.log_level = levels_dict[level_string] - except KeyError: - raise BadParameter("Invalid log level: '%s'" % level_string) - - def set_log_format(self, format_string): - # BUG! Format string never actually used in this function. - try: - self._log(debug, "This is a log formatting test", None) - except KeyError: - raise BadParameter("Bad format string: '%s'" % format_string) Copied: trunk/jython/Lib/modjy/modjy_log.py (from rev 6070, branches/modjy/Lib/modjy/modjy_log.py) =================================================================== --- trunk/jython/Lib/modjy/modjy_log.py (rev 0) +++ trunk/jython/Lib/modjy/modjy_log.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,80 @@ +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +import java + +import sys + +DEBUG = 'debug' +INFO = 'info' +WARN = 'warn' +ERROR = 'error' +FATAL = 'fatal' + +levels_dict = {} +ix = 0 +for level in [DEBUG, INFO, WARN, ERROR, FATAL, ]: + levels_dict[level]=ix + ix += 1 + +class modjy_logger: + + def __init__(self, context): + self.log_ctx = context + self.format_str = "%(lvl)s:\t%(msg)s" + self.log_level = levels_dict[DEBUG] + + def _log(self, level, level_str, msg, exc): + if level >= self.log_level: + msg = self.format_str % {'lvl': level_str, 'msg': msg, } + if exc: +# java.lang.System.err.println(msg, exc) + self.log_ctx.log(msg, exc) + else: +# java.lang.System.err.println(msg) + self.log_ctx.log(msg) + + def debug(self, msg, exc=None): + self._log(0, DEBUG, msg, exc) + + def info(self, msg, exc=None): + self._log(1, INFO, msg, exc) + + def warn(self, msg, exc=None): + self._log(2, WARN, msg, exc) + + def error(self, msg, exc=None): + self._log(3, ERROR, msg, exc) + + def fatal(self, msg, exc=None): + self._log(4, FATAL, msg, exc) + + def set_log_level(self, level_string): + try: + self.log_level = levels_dict[level_string] + except KeyError: + raise BadParameter("Invalid log level: '%s'" % level_string) + + def set_log_format(self, format_string): + # BUG! Format string never actually used in this function. + try: + self._log(debug, "This is a log formatting test", None) + except KeyError: + raise BadParameter("Bad format string: '%s'" % format_string) Deleted: trunk/jython/Lib/modjy/modjy_params.py =================================================================== --- branches/modjy/Lib/modjy/modjy_params.py 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Lib/modjy/modjy_params.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,84 +0,0 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -from UserDict import UserDict - -BOOLEAN = ('boolean', int) -INTEGER = ('integer', int) -FLOAT = ('float', float) -STRING = ('string', None) - -modjy_servlet_params = { - - 'multithread': (BOOLEAN, 1), - 'cache_callables': (BOOLEAN, 1), - 'reload_on_mod': (BOOLEAN, 0), - - 'app_import_name': (STRING, None), - - 'app_directory': (STRING, None), - 'app_filename': (STRING, 'application.py'), - 'app_callable_name': (STRING, 'handler'), - 'callable_query_name': (STRING, None), - - 'exc_handler': (STRING, 'standard'), - - 'log_level': (STRING, 'info'), - - 'packages': (STRING, None), - 'classdirs': (STRING, None), - 'extdirs': (STRING, None), - - 'initial_env': (STRING, None), -} - -class modjy_param_mgr(UserDict): - - def __init__(self, param_types): - UserDict.__init__(self) - self.param_types = param_types - for pname in self.param_types.keys(): - typ, default = self.param_types[pname] - self.__setitem__(pname, default) - - def __getitem__(self, name): - return self._get_defaulted_value(name) - - def __setitem__(self, name, value): - self.data[name] = self._convert_value(name, value) - - def _convert_value(self, name, value): - if self.param_types.has_key(name): - typ, default = self.param_types[name] - typ_str, typ_func = typ - if typ_func: - try: - return typ_func(value) - except ValueError: - raise BadParameter("Illegal value for %s parameter '%s': %s" % (typ_str, name, value) ) - return value - - def _get_defaulted_value(self, name): - if self.data.has_key(name): - return self.data[name] - if self.param_types.has_key(name): - typ, default = self.param_types[name] - return default - raise KeyError(name) Copied: trunk/jython/Lib/modjy/modjy_params.py (from rev 6070, branches/modjy/Lib/modjy/modjy_params.py) =================================================================== --- trunk/jython/Lib/modjy/modjy_params.py (rev 0) +++ trunk/jython/Lib/modjy/modjy_params.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -0,0 +1,84 @@ +### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +### + +from UserDict import UserDict + +BOOLEAN = ('boolean', int) +INTEGER = ('integer', int) +FLOAT = ('float', float) +STRING = ('string', None) + +modjy_servlet_params = { + + 'multithread': (BOOLEAN, 1), + 'cache_callables': (BOOLEAN, 1), + 'reload_on_mod': (BOOLEAN, 0), + + 'app_import_name': (STRING, None), + + 'app_directory': (STRING, None), + 'app_filename': (STRING, 'application.py'), + 'app_callable_name': (STRING, 'handler'), + 'callable_query_name': (STRING, None), + + 'exc_handler': (STRING, 'standard'), + + 'log_level': (STRING, 'info'), + + 'packages': (STRING, None), + 'classdirs': (STRING, None), + 'extdirs': (STRING, None), + + 'initial_env': (STRING, None), +} + +class modjy_param_mgr(UserDict): + + def __init__(self, param_types): + UserDict.__init__(self) + self.param_types = param_types + for pname in self.param_types.keys(): + typ, default = self.param_types[pname] + self.__setitem__(pname, default) + + def __getitem__(self, name): + return self._get_defaulted_value(name) + + def __setitem__(self, name, value): + self.data[name] = self._convert_value(name, value) + + def _convert_value(self, name, value): + if self.param_types.has_key(name): + typ, default = self.param_types[name] + typ_str, typ_func = typ + if typ_func: + try: + return typ_func(value) + except ValueError: + raise BadParameter("Illegal value for %s parameter '%s': %s" % (typ_str, name, value) ) + return value + + def _get_defaulted_value(self, name): + if self.data.has_key(name): + return self.data[name] + if self.param_types.has_key(name): + typ, default = self.param_types[name] + return default + raise KeyError(name) Deleted: trunk/jython/Lib/modjy/modjy_publish.py =================================================================== --- branches/modjy/Lib/modjy/modjy_publish.py 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/Lib/modjy/modjy_publish.py 2009-03-06 18:27:15 UTC (rev 6075) @@ -1,138 +0,0 @@ -### -# -# Copyright Alan Kennedy. -# -# You may contact the copyright holder at this uri: -# -# http://www.xhaus.com/contact/modjy -# -# The licence under which this code is released is the Apache License v2.0. -# -# The terms and conditions of this license are listed in a file contained -# in the distribution that also contained this file, under the name -# LICENSE.txt. -# -# You may also read a copy of the license at the following web address. -# -# http://modjy.xhaus.com/LICENSE.txt -# -### - -import sys -import synchronize - -from java.io import File - -from modjy_exceptions import * - -class modjy_publisher: - - def init_publisher(self): - self.cache = None - if self.params['app_directory']: - self.app_directory = self.expand_relative_path(self.params['app_directory']) - else: - self.app_directory = self.servlet_context.getRealPath('/') - self.params['app_directory'] = self.app_directory - if not self.app_directory in sys.path: - sys.path.append(self.app_directory) - - def map_uri(self, req, environ): - source_uri = '%s%s%s' % (self.app_directory, File.separator, self.params['app_filename']) - callable_name = self.params['app_callable_name'] - if self.params['callable_query_name']: - query_string = req.getQueryString() - if query_string and '=' in query_string: - for name_val in query_string.split('&'): - name, value = name_val.split('=') - if name == self.params['callable_query_name']: - callable_name = value - return source_uri, callable_name - - def get_app_object(self, req, environ): - environ["SCRIPT_NAME"] = "%s%s" % (req.getContextPath(), req.getServletPath()) - path_info = req.getPathInfo() or "" - environ["PATH_INFO"] = path_info - environ["PATH_TRANSLATED"] = File(self.app_directory, path_info).getPath() - - if self.params['app_import_name'] is not None: - return self.get_app_object_importable(self.params['app_import_name']) - else: - if self.cache is None: - self.cache = {} - return self.get_app_object_old_style(req, environ) - - get_app_object = synchronize.make_synchronized(get_app_object) - - def get_app_object_importable(self, importable_name): - self.log.debug("Attempting to import application callable '%s'\n" % (importable_name, )) - # Under the importable mechanism, the cache contains a single object - if self.cache is None: - application, instantiable, method_name = self.load_importable(importable_name.strip()) - if instantiable and self.params['cache_callables']: - application = application() - self.cache = application, instantiable, method_name - application, instantiable, method_name = self.cache - self.log.debug("Application is " + str(application)) - if instantiable and not self.params['cache_callables']: - application = application() - self.log.debug("Instantiated application is " + str(application)) - if method_name is not None: - if not hasattr(application, method_name): - self.log.fatal("Attribute error application callable '%s' as no method '%s'" % (application, method_name)) - self.raise_exc(ApplicationNotFound, "Attribute error application callable '%s' as no method '%s'" % (application, method_name)) - application = getattr(application, method_name) - self.log.debug("Application method is " + str(application)) - return application - - def load_importable(sel... [truncated message content] |
From: <fwi...@us...> - 2009-03-06 17:58:50
|
Revision: 6074 http://jython.svn.sourceforge.net/jython/?rev=6074&view=rev Author: fwierzbicki Date: 2009-03-06 17:58:41 +0000 (Fri, 06 Mar 2009) Log Message: ----------- Initialized merge tracking via "svnmerge" with revisions "1-5750" from https://jython.svn.sourceforge.net/svnroot/jython/branches/modjy Property Changed: ---------------- trunk/jython/ Property changes on: trunk/jython ___________________________________________________________________ Modified: svnmerge-integrated - /branches/pbcvm:1-6045 + /branches/modjy:1-5750 /branches/pbcvm:1-6045 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-06 16:42:05
|
Revision: 6073 http://jython.svn.sourceforge.net/jython/?rev=6073&view=rev Author: fwierzbicki Date: 2009-03-06 16:15:19 +0000 (Fri, 06 Mar 2009) Log Message: ----------- Merged revisions 5752,5756-5758,5761-5763,5765-5775,5778-5816,5818-5840,5842-5847,5854,5857-5859,5863-5865,5869,5875,5877,5884-5885,5889-5893,5900-5901,5903-5906,5908,5912-5918,5920,5923,5925,5927,5930-5932,5934-5947,5950-5951,5953-5957,5959,5961,5965-5966,5971-5976,5978-5979,5981-5983,5992,6001,6003,6006-6014,6023,6031-6037,6039-6040,6045-6047,6049-6052,6061-6065,6071 via svnmerge from https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython Modified Paths: -------------- branches/modjy/.classpath branches/modjy/CPythonLib.includes branches/modjy/CoreExposed.includes branches/modjy/LICENSE.txt branches/modjy/Lib/decimal.py branches/modjy/Lib/grp.py branches/modjy/Lib/marshal.py branches/modjy/Lib/new.py branches/modjy/Lib/os.py branches/modjy/Lib/platform.py branches/modjy/Lib/pwd.py branches/modjy/Lib/pydoc.py branches/modjy/Lib/site.py branches/modjy/Lib/socket.py branches/modjy/Lib/test/regrtest.py branches/modjy/Lib/test/string_tests.py branches/modjy/Lib/test/test_StringIO_jy.py branches/modjy/Lib/test/test_array.py branches/modjy/Lib/test/test_array_jy.py branches/modjy/Lib/test/test_builtin_jy.py branches/modjy/Lib/test/test_class_jy.py branches/modjy/Lib/test/test_cmd_line.py branches/modjy/Lib/test/test_codeop.py branches/modjy/Lib/test/test_descr_jy.py branches/modjy/Lib/test/test_eof_jy.py branches/modjy/Lib/test/test_func_syntax_jy.py branches/modjy/Lib/test/test_genexps_jy.py branches/modjy/Lib/test/test_grammar_jy.py branches/modjy/Lib/test/test_import_jy.py branches/modjy/Lib/test/test_java_integration.py branches/modjy/Lib/test/test_java_visibility.py branches/modjy/Lib/test/test_list_jy.py branches/modjy/Lib/test/test_select.py branches/modjy/Lib/test/test_socket.py branches/modjy/Lib/test/test_support.py branches/modjy/Lib/test/test_sys_jy.py branches/modjy/Lib/test/test_thread_jy.py branches/modjy/Lib/test/test_traceback.py branches/modjy/Lib/test/test_tuple.py branches/modjy/Lib/test/test_unicode_jy.py branches/modjy/Lib/test/test_zlib.py branches/modjy/Lib/threading.py branches/modjy/Lib/zlib.py branches/modjy/README.txt branches/modjy/ast/Python.asdl branches/modjy/ast/asdl_antlr.py branches/modjy/ast/astview.py branches/modjy/bugtests/README.txt branches/modjy/bugtests/test386.py branches/modjy/bugtests/test394.py branches/modjy/bugtests/test394jar/MANIFEST.MF branches/modjy/build.xml branches/modjy/extlibs/jna-posix.jar branches/modjy/grammar/Python.g branches/modjy/grammar/PythonPartial.g branches/modjy/registry branches/modjy/src/com/ziclix/python/sql/handler/RowIdHandler.java branches/modjy/src/org/python/antlr/GrammarActions.java branches/modjy/src/org/python/antlr/PythonTokenSource.java branches/modjy/src/org/python/antlr/adapter/AstAdapters.java branches/modjy/src/org/python/antlr/ast/AssertDerived.java branches/modjy/src/org/python/antlr/ast/AssignDerived.java branches/modjy/src/org/python/antlr/ast/AttributeDerived.java branches/modjy/src/org/python/antlr/ast/AugAssignDerived.java branches/modjy/src/org/python/antlr/ast/BinOpDerived.java branches/modjy/src/org/python/antlr/ast/BoolOpDerived.java branches/modjy/src/org/python/antlr/ast/BreakDerived.java branches/modjy/src/org/python/antlr/ast/CallDerived.java branches/modjy/src/org/python/antlr/ast/ClassDefDerived.java branches/modjy/src/org/python/antlr/ast/CompareDerived.java branches/modjy/src/org/python/antlr/ast/ContinueDerived.java branches/modjy/src/org/python/antlr/ast/DeleteDerived.java branches/modjy/src/org/python/antlr/ast/DictDerived.java branches/modjy/src/org/python/antlr/ast/EllipsisDerived.java branches/modjy/src/org/python/antlr/ast/ExceptHandler.java branches/modjy/src/org/python/antlr/ast/ExceptHandlerDerived.java branches/modjy/src/org/python/antlr/ast/ExecDerived.java branches/modjy/src/org/python/antlr/ast/ExprDerived.java branches/modjy/src/org/python/antlr/ast/ExpressionDerived.java branches/modjy/src/org/python/antlr/ast/ExtSliceDerived.java branches/modjy/src/org/python/antlr/ast/ForDerived.java branches/modjy/src/org/python/antlr/ast/FunctionDefDerived.java branches/modjy/src/org/python/antlr/ast/GeneratorExpDerived.java branches/modjy/src/org/python/antlr/ast/GlobalDerived.java branches/modjy/src/org/python/antlr/ast/IfDerived.java branches/modjy/src/org/python/antlr/ast/IfExpDerived.java branches/modjy/src/org/python/antlr/ast/ImportDerived.java branches/modjy/src/org/python/antlr/ast/ImportFromDerived.java branches/modjy/src/org/python/antlr/ast/IndexDerived.java branches/modjy/src/org/python/antlr/ast/InteractiveDerived.java branches/modjy/src/org/python/antlr/ast/LambdaDerived.java branches/modjy/src/org/python/antlr/ast/ListCompDerived.java branches/modjy/src/org/python/antlr/ast/ListDerived.java branches/modjy/src/org/python/antlr/ast/ModuleDerived.java branches/modjy/src/org/python/antlr/ast/NameDerived.java branches/modjy/src/org/python/antlr/ast/NumDerived.java branches/modjy/src/org/python/antlr/ast/PassDerived.java branches/modjy/src/org/python/antlr/ast/PrintDerived.java branches/modjy/src/org/python/antlr/ast/Raise.java branches/modjy/src/org/python/antlr/ast/RaiseDerived.java branches/modjy/src/org/python/antlr/ast/ReprDerived.java branches/modjy/src/org/python/antlr/ast/ReturnDerived.java branches/modjy/src/org/python/antlr/ast/SliceDerived.java branches/modjy/src/org/python/antlr/ast/StrDerived.java branches/modjy/src/org/python/antlr/ast/SubscriptDerived.java branches/modjy/src/org/python/antlr/ast/SuiteDerived.java branches/modjy/src/org/python/antlr/ast/TryExceptDerived.java branches/modjy/src/org/python/antlr/ast/TryFinallyDerived.java branches/modjy/src/org/python/antlr/ast/TupleDerived.java branches/modjy/src/org/python/antlr/ast/UnaryOpDerived.java branches/modjy/src/org/python/antlr/ast/WhileDerived.java branches/modjy/src/org/python/antlr/ast/WithDerived.java branches/modjy/src/org/python/antlr/ast/YieldDerived.java branches/modjy/src/org/python/antlr/ast/aliasDerived.java branches/modjy/src/org/python/antlr/ast/argumentsDerived.java branches/modjy/src/org/python/antlr/ast/comprehensionDerived.java branches/modjy/src/org/python/antlr/ast/keywordDerived.java branches/modjy/src/org/python/antlr/op/AddDerived.java branches/modjy/src/org/python/antlr/op/AndDerived.java branches/modjy/src/org/python/antlr/op/AugLoadDerived.java branches/modjy/src/org/python/antlr/op/AugStoreDerived.java branches/modjy/src/org/python/antlr/op/BitAndDerived.java branches/modjy/src/org/python/antlr/op/BitOrDerived.java branches/modjy/src/org/python/antlr/op/BitXorDerived.java branches/modjy/src/org/python/antlr/op/DelDerived.java branches/modjy/src/org/python/antlr/op/DivDerived.java branches/modjy/src/org/python/antlr/op/EqDerived.java branches/modjy/src/org/python/antlr/op/FloorDivDerived.java branches/modjy/src/org/python/antlr/op/GtDerived.java branches/modjy/src/org/python/antlr/op/GtEDerived.java branches/modjy/src/org/python/antlr/op/InDerived.java branches/modjy/src/org/python/antlr/op/InvertDerived.java branches/modjy/src/org/python/antlr/op/IsDerived.java branches/modjy/src/org/python/antlr/op/IsNotDerived.java branches/modjy/src/org/python/antlr/op/LShiftDerived.java branches/modjy/src/org/python/antlr/op/LoadDerived.java branches/modjy/src/org/python/antlr/op/LtDerived.java branches/modjy/src/org/python/antlr/op/LtEDerived.java branches/modjy/src/org/python/antlr/op/ModDerived.java branches/modjy/src/org/python/antlr/op/MultDerived.java branches/modjy/src/org/python/antlr/op/NotDerived.java branches/modjy/src/org/python/antlr/op/NotEqDerived.java branches/modjy/src/org/python/antlr/op/NotInDerived.java branches/modjy/src/org/python/antlr/op/OrDerived.java branches/modjy/src/org/python/antlr/op/ParamDerived.java branches/modjy/src/org/python/antlr/op/PowDerived.java branches/modjy/src/org/python/antlr/op/RShiftDerived.java branches/modjy/src/org/python/antlr/op/StoreDerived.java branches/modjy/src/org/python/antlr/op/SubDerived.java branches/modjy/src/org/python/antlr/op/UAddDerived.java branches/modjy/src/org/python/antlr/op/USubDerived.java branches/modjy/src/org/python/compiler/AdapterMaker.java branches/modjy/src/org/python/compiler/ClassFile.java branches/modjy/src/org/python/compiler/Code.java branches/modjy/src/org/python/compiler/CodeCompiler.java branches/modjy/src/org/python/compiler/Constant.java branches/modjy/src/org/python/compiler/Future.java branches/modjy/src/org/python/compiler/JavaMaker.java branches/modjy/src/org/python/compiler/Module.java branches/modjy/src/org/python/compiler/ProxyMaker.java branches/modjy/src/org/python/compiler/ScopeInfo.java branches/modjy/src/org/python/compiler/ScopesCompiler.java branches/modjy/src/org/python/core/AbstractArray.java branches/modjy/src/org/python/core/ArgParser.java branches/modjy/src/org/python/core/AstList.java branches/modjy/src/org/python/core/BaseSet.java branches/modjy/src/org/python/core/BytecodeLoader.java branches/modjy/src/org/python/core/CompilerFlags.java branches/modjy/src/org/python/core/JavaImporter.java branches/modjy/src/org/python/core/Options.java branches/modjy/src/org/python/core/ParserFacade.java branches/modjy/src/org/python/core/Py.java branches/modjy/src/org/python/core/PyArray.java branches/modjy/src/org/python/core/PyArrayDerived.java branches/modjy/src/org/python/core/PyBaseExceptionDerived.java branches/modjy/src/org/python/core/PyBoolean.java branches/modjy/src/org/python/core/PyBooleanDerived.java branches/modjy/src/org/python/core/PyBuiltinMethodNarrow.java branches/modjy/src/org/python/core/PyClassMethod.java branches/modjy/src/org/python/core/PyClassMethodDerived.java branches/modjy/src/org/python/core/PyComplex.java branches/modjy/src/org/python/core/PyComplexDerived.java branches/modjy/src/org/python/core/PyDictionary.java branches/modjy/src/org/python/core/PyDictionaryDerived.java branches/modjy/src/org/python/core/PyEnumerate.java branches/modjy/src/org/python/core/PyEnumerateDerived.java branches/modjy/src/org/python/core/PyException.java branches/modjy/src/org/python/core/PyFile.java branches/modjy/src/org/python/core/PyFileDerived.java branches/modjy/src/org/python/core/PyFloat.java branches/modjy/src/org/python/core/PyFloatDerived.java branches/modjy/src/org/python/core/PyFrame.java branches/modjy/src/org/python/core/PyFrozenSet.java branches/modjy/src/org/python/core/PyFrozenSetDerived.java branches/modjy/src/org/python/core/PyFunction.java branches/modjy/src/org/python/core/PyInstance.java branches/modjy/src/org/python/core/PyInteger.java branches/modjy/src/org/python/core/PyIntegerDerived.java branches/modjy/src/org/python/core/PyIterator.java branches/modjy/src/org/python/core/PyJavaPackage.java branches/modjy/src/org/python/core/PyJavaType.java branches/modjy/src/org/python/core/PyList.java branches/modjy/src/org/python/core/PyListDerived.java branches/modjy/src/org/python/core/PyLong.java branches/modjy/src/org/python/core/PyLongDerived.java branches/modjy/src/org/python/core/PyMethod.java branches/modjy/src/org/python/core/PyMethodDescr.java branches/modjy/src/org/python/core/PyModuleDerived.java branches/modjy/src/org/python/core/PyNewWrapper.java branches/modjy/src/org/python/core/PyObject.java branches/modjy/src/org/python/core/PyObjectDerived.java branches/modjy/src/org/python/core/PyObjectList.java branches/modjy/src/org/python/core/PyProperty.java branches/modjy/src/org/python/core/PyPropertyDerived.java branches/modjy/src/org/python/core/PyReflectedConstructor.java branches/modjy/src/org/python/core/PyReflectedFunction.java branches/modjy/src/org/python/core/PySequence.java branches/modjy/src/org/python/core/PySequenceList.java branches/modjy/src/org/python/core/PySet.java branches/modjy/src/org/python/core/PySetDerived.java branches/modjy/src/org/python/core/PySlice.java branches/modjy/src/org/python/core/PySliceDerived.java branches/modjy/src/org/python/core/PyStaticMethod.java branches/modjy/src/org/python/core/PyString.java branches/modjy/src/org/python/core/PyStringDerived.java branches/modjy/src/org/python/core/PyStringMap.java branches/modjy/src/org/python/core/PySuper.java branches/modjy/src/org/python/core/PySuperDerived.java branches/modjy/src/org/python/core/PySystemState.java branches/modjy/src/org/python/core/PyTableCode.java branches/modjy/src/org/python/core/PyTraceback.java branches/modjy/src/org/python/core/PyTuple.java branches/modjy/src/org/python/core/PyTupleDerived.java branches/modjy/src/org/python/core/PyType.java branches/modjy/src/org/python/core/PyTypeDerived.java branches/modjy/src/org/python/core/PyUnicode.java branches/modjy/src/org/python/core/PyUnicodeDerived.java branches/modjy/src/org/python/core/PyXRange.java branches/modjy/src/org/python/core/ReflectedArgs.java branches/modjy/src/org/python/core/SyspathJavaLoader.java branches/modjy/src/org/python/core/ThreadStateMapping.java branches/modjy/src/org/python/core/__builtin__.java branches/modjy/src/org/python/core/adapter/ClassicPyObjectAdapter.java branches/modjy/src/org/python/core/codecs.java branches/modjy/src/org/python/core/exceptions.java branches/modjy/src/org/python/core/imp.java branches/modjy/src/org/python/core/io/FileIO.java branches/modjy/src/org/python/core/io/IOBase.java branches/modjy/src/org/python/core/io/ServerSocketIO.java branches/modjy/src/org/python/core/packagecache/CachedJarsPackageManager.java branches/modjy/src/org/python/core/packagecache/PackageManager.java branches/modjy/src/org/python/core/packagecache/PathPackageManager.java branches/modjy/src/org/python/expose/BaseTypeBuilder.java branches/modjy/src/org/python/expose/generate/ClassMethodExposer.java branches/modjy/src/org/python/expose/generate/DescriptorExposer.java branches/modjy/src/org/python/expose/generate/ExposeTask.java branches/modjy/src/org/python/expose/generate/ExposedFieldFinder.java branches/modjy/src/org/python/expose/generate/ExposedMethodFinder.java branches/modjy/src/org/python/expose/generate/ExposedTypeProcessor.java branches/modjy/src/org/python/expose/generate/ExposedTypeVisitor.java branches/modjy/src/org/python/expose/generate/Exposer.java branches/modjy/src/org/python/expose/generate/InstanceMethodExposer.java branches/modjy/src/org/python/expose/generate/MethodExposer.java branches/modjy/src/org/python/expose/generate/NewExposer.java branches/modjy/src/org/python/expose/generate/OverridableNewExposer.java branches/modjy/src/org/python/expose/generate/PyTypes.java branches/modjy/src/org/python/expose/generate/RestrictiveAnnotationVisitor.java branches/modjy/src/org/python/expose/generate/TypeExposer.java branches/modjy/src/org/python/modules/ArrayModule.java branches/modjy/src/org/python/modules/Setup.java branches/modjy/src/org/python/modules/_collections/PyDefaultDictDerived.java branches/modjy/src/org/python/modules/_collections/PyDeque.java branches/modjy/src/org/python/modules/_collections/PyDequeDerived.java branches/modjy/src/org/python/modules/_csv/PyDialectDerived.java branches/modjy/src/org/python/modules/_csv/PyWriter.java branches/modjy/src/org/python/modules/_functools/PyPartialDerived.java branches/modjy/src/org/python/modules/_newmodule.java branches/modjy/src/org/python/modules/_py_compile.java branches/modjy/src/org/python/modules/_weakref/GlobalRef.java branches/modjy/src/org/python/modules/_weakref/ReferenceTypeDerived.java branches/modjy/src/org/python/modules/_weakref/WeakrefModule.java branches/modjy/src/org/python/modules/binascii.java branches/modjy/src/org/python/modules/cPickle.java branches/modjy/src/org/python/modules/cStringIO.java branches/modjy/src/org/python/modules/errno.java branches/modjy/src/org/python/modules/imp.java branches/modjy/src/org/python/modules/random/PyRandomDerived.java branches/modjy/src/org/python/modules/random/RandomModule.java branches/modjy/src/org/python/modules/sre/PatternObject.java branches/modjy/src/org/python/modules/struct.java branches/modjy/src/org/python/modules/thread/PyLocal.java branches/modjy/src/org/python/modules/thread/PyLocalDerived.java branches/modjy/src/org/python/modules/time/Time.java branches/modjy/src/org/python/modules/ucnhash.java branches/modjy/src/org/python/modules/zipimport/zipimport.java branches/modjy/src/org/python/modules/zipimport/zipimporter.java branches/modjy/src/org/python/modules/zipimport/zipimporterDerived.java branches/modjy/src/org/python/util/Generic.java branches/modjy/src/org/python/util/InteractiveConsole.java branches/modjy/src/org/python/util/JythoncAntTask.java branches/modjy/src/org/python/util/NameUnionAntType.java branches/modjy/src/org/python/util/jython.java branches/modjy/src/shell/jython branches/modjy/src/shell/jython.bat branches/modjy/src/templates/gderived-defs branches/modjy/src/templates/gderived.py branches/modjy/src/templates/mappings branches/modjy/src/templates/object.derived branches/modjy/tests/java/javatests/ListTest.java branches/modjy/tests/java/javatests/TestSupport.java branches/modjy/tests/java/org/python/expose/generate/DescriptorExposerTest.java branches/modjy/tests/java/org/python/expose/generate/ExposeMethodFinderTest.java branches/modjy/tests/java/org/python/expose/generate/ExposedTypeProcessorTest.java branches/modjy/tests/java/org/python/expose/generate/ExposedTypeVisitorTest.java branches/modjy/tests/java/org/python/expose/generate/MethodExposerTest.java branches/modjy/tests/java/org/python/expose/generate/NewExposerTest.java branches/modjy/tests/java/org/python/expose/generate/OverridableNewExposerTest.java branches/modjy/tests/java/org/python/expose/generate/TypeExposerTest.java branches/modjy/tests/java/org/python/tests/Callbacker.java branches/modjy/tests/java/org/python/tests/Invisible.java branches/modjy/tests/java/org/python/tests/SubVisible.java branches/modjy/tests/java/org/python/tests/VisibilityResults.java branches/modjy/tests/java/org/python/tests/Visible.java branches/modjy/tests/java/org/python/util/InterpreterTest.java Added Paths: ----------- branches/modjy/Lib/asyncore.py branches/modjy/Lib/pycimport.py branches/modjy/Lib/pyexpat.py branches/modjy/Lib/signal.py branches/modjy/Lib/test/access_protected_class.py branches/modjy/Lib/test/access_protected_field.py branches/modjy/Lib/test/anygui.py branches/modjy/Lib/test/bug1239.jar branches/modjy/Lib/test/call_protected_method.py branches/modjy/Lib/test/check_for_initializer_in_syspath.py branches/modjy/Lib/test/classimport.jar branches/modjy/Lib/test/classimport_Lib.jar branches/modjy/Lib/test/eof_fodder7.py branches/modjy/Lib/test/except_in_raising_code.py branches/modjy/Lib/test/import_nonexistent.py branches/modjy/Lib/test/import_star_from_java.py branches/modjy/Lib/test/invalid_utf_8_declared_encoding.py branches/modjy/Lib/test/latin1_no_encoding.py branches/modjy/Lib/test/output/test_signal branches/modjy/Lib/test/python_home.policy branches/modjy/Lib/test/sys_jy_test_module.py branches/modjy/Lib/test/syspath_import.jar branches/modjy/Lib/test/test_classpathimporter.py branches/modjy/Lib/test/test_codeop_jy.py branches/modjy/Lib/test/test_compile_jy.py branches/modjy/Lib/test/test_doctest.py branches/modjy/Lib/test/test_int_jy.py branches/modjy/Lib/test/test_java_subclasses.py branches/modjy/Lib/test/test_jython_initializer.py branches/modjy/Lib/test/test_listcomp_jy.py branches/modjy/Lib/test/test_marshal.py branches/modjy/Lib/test/test_new.py branches/modjy/Lib/test/test_pep263_jy.py branches/modjy/Lib/test/test_sax_jy.py branches/modjy/Lib/test/test_set_jy.py branches/modjy/Lib/test/test_signal.py branches/modjy/Lib/test/test_timeit.py branches/modjy/Lib/test/test_traceback_jy.py branches/modjy/Lib/test/test_xml_etree.py branches/modjy/Lib/test/test_xml_etree_c.py branches/modjy/Lib/test/test_xml_etree_jy.py branches/modjy/Lib/test/test_zipimport_jy.py branches/modjy/Lib/timeit.py branches/modjy/Lib/xml/etree/ branches/modjy/Lib/xml/etree/cElementTree.py branches/modjy/Lib/xml/parsers/ branches/modjy/Lib/xml/parsers/__init__.py branches/modjy/Lib/xml/parsers/expat.py branches/modjy/Misc/make_pydocs.py branches/modjy/Tools/pbcvm/ branches/modjy/Tools/pbcvm/extract.py branches/modjy/extlibs/antlr-3.1.2.jar branches/modjy/extlibs/antlr-runtime-3.1.2.jar branches/modjy/extlibs/cpptasks/ branches/modjy/extlibs/cpptasks/cpptasks.jar branches/modjy/extlibs/modjy_0_25_3.zip branches/modjy/extlibs/xercesImpl-2.9.1.jar branches/modjy/src/org/python/compiler/MTime.java branches/modjy/src/org/python/compiler/pbc/ branches/modjy/src/org/python/compiler/pbc/Bytecode.java branches/modjy/src/org/python/compiler/pbc/BytecodeCompiler.java branches/modjy/src/org/python/core/AnnotationReader.java branches/modjy/src/org/python/core/BuiltinDocs.java branches/modjy/src/org/python/core/ClasspathPyImporter.java branches/modjy/src/org/python/core/ClasspathPyImporterDerived.java branches/modjy/src/org/python/core/JythonInitializer.java branches/modjy/src/org/python/core/Opcode.java branches/modjy/src/org/python/core/PyBaseCode.java branches/modjy/src/org/python/core/PyBytecode.java branches/modjy/src/org/python/core/WrappedIterIterator.java branches/modjy/src/org/python/core/util/importer.java branches/modjy/src/org/python/modules/PyIOFile.java branches/modjy/src/org/python/modules/PyIOFileFactory.java branches/modjy/src/org/python/modules/_marshal.java branches/modjy/src/org/python/util/GlobMatchingTask.java branches/modjy/src/org/python/util/JycompileAntTask.java branches/modjy/src/templates/ClasspathPyImporter.derived branches/modjy/tests/data/ branches/modjy/tests/data/initializer/ branches/modjy/tests/data/initializer/META-INF/ branches/modjy/tests/data/initializer/META-INF/services/ branches/modjy/tests/data/initializer/META-INF/services/org.python.core.JythonInitializer branches/modjy/tests/data/initializer/SyspathAppendingInitializer.java branches/modjy/tests/java/javatests/PySetInJavaTest.java branches/modjy/tests/java/org/python/tests/BadStaticInitializer.java branches/modjy/tests/java/org/python/tests/BeanImplementation.java branches/modjy/tests/java/org/python/tests/BeanInterface.java branches/modjy/tests/java/org/python/tests/Child.java branches/modjy/tests/java/org/python/tests/Coercions.java branches/modjy/tests/java/org/python/tests/CustomizableMapHolder.java branches/modjy/tests/java/org/python/tests/ExceptionTest.java branches/modjy/tests/java/org/python/tests/HiddenSuper.java branches/modjy/tests/java/org/python/tests/Matryoshka.java branches/modjy/tests/java/org/python/tests/OnlySubclassable.java branches/modjy/tests/java/org/python/tests/OtherSubVisible.java branches/modjy/tests/java/org/python/tests/Parent.java branches/modjy/tests/java/org/python/tests/SomePyMethods.java branches/modjy/tests/java/org/python/tests/inbred/ branches/modjy/tests/java/org/python/tests/inbred/Metis.java branches/modjy/tests/java/org/python/tests/inbred/Zeus.java branches/modjy/tests/java/org/python/tests/mro/ branches/modjy/tests/java/org/python/tests/mro/ConfusedOnGetitemAdd.java branches/modjy/tests/java/org/python/tests/mro/ConfusedOnImport.java branches/modjy/tests/java/org/python/tests/mro/FirstAndPost.java branches/modjy/tests/java/org/python/tests/mro/FirstAndSecond.java branches/modjy/tests/java/org/python/tests/mro/FirstPredefinedGetitem.java branches/modjy/tests/java/org/python/tests/mro/GetitemAdder.java branches/modjy/tests/java/org/python/tests/mro/PostAndFirst.java branches/modjy/tests/java/org/python/tests/mro/PostdefinedGetitem.java branches/modjy/tests/java/org/python/tests/mro/SecondAndFirst.java branches/modjy/tests/java/org/python/tests/mro/SecondPredefinedGetitem.java Removed Paths: ------------- branches/modjy/Lib/asyncore.py branches/modjy/Lib/test/test_bool.py branches/modjy/Lib/test/test_exceptions.py branches/modjy/Lib/test/test_jsubclass.py branches/modjy/Lib/test/test_jy_compile.py branches/modjy/Lib/xml/etree/cElementTree.py branches/modjy/Lib/xml/parsers/__init__.py branches/modjy/Lib/xml/parsers/expat.py branches/modjy/Tools/pbcvm/extract.py branches/modjy/bugtests/classes/test090j.java branches/modjy/bugtests/classes/test092m/ branches/modjy/bugtests/classes/test119j.java branches/modjy/bugtests/classes/test121p/ branches/modjy/bugtests/classes/test139j1.java branches/modjy/bugtests/classes/test139j2.java branches/modjy/bugtests/classes/test139j3.java branches/modjy/bugtests/classes/test142j.java branches/modjy/bugtests/classes/test160j1.java branches/modjy/bugtests/classes/test160j2.java branches/modjy/bugtests/classes/test182j.java branches/modjy/bugtests/classes/test202j.java branches/modjy/bugtests/classes/test204j0.java branches/modjy/bugtests/classes/test204j1.java branches/modjy/bugtests/classes/test204j2.java branches/modjy/bugtests/classes/test204j3.java branches/modjy/bugtests/classes/test205j0.java branches/modjy/bugtests/classes/test205j1.java branches/modjy/bugtests/classes/test205j2.java branches/modjy/bugtests/classes/test206j0.java branches/modjy/bugtests/classes/test206j1.java branches/modjy/bugtests/classes/test208j.java branches/modjy/bugtests/classes/test208j0.java branches/modjy/bugtests/classes/test208j1.java branches/modjy/bugtests/classes/test208j2.java branches/modjy/bugtests/classes/test217p/ branches/modjy/bugtests/classes/test219e.java branches/modjy/bugtests/classes/test219i.java branches/modjy/bugtests/classes/test219j.java branches/modjy/bugtests/classes/test220e.java branches/modjy/bugtests/classes/test220i.java branches/modjy/bugtests/classes/test220j.java branches/modjy/bugtests/classes/test231j.java branches/modjy/bugtests/classes/test231j2.java branches/modjy/bugtests/classes/test232p/ branches/modjy/bugtests/classes/test236j1.java branches/modjy/bugtests/classes/test236j2.java branches/modjy/bugtests/classes/test246p/ branches/modjy/bugtests/classes/test248j.java branches/modjy/bugtests/classes/test288i.java branches/modjy/bugtests/classes/test288j.java branches/modjy/bugtests/classes/test395j1.java branches/modjy/bugtests/classes/test395j2.java branches/modjy/bugtests/classes/test396j.java branches/modjy/bugtests/test087.py branches/modjy/bugtests/test087m.py branches/modjy/bugtests/test088.py branches/modjy/bugtests/test088p/ branches/modjy/bugtests/test090.py branches/modjy/bugtests/test091.py branches/modjy/bugtests/test091j.java branches/modjy/bugtests/test092.py branches/modjy/bugtests/test093.py branches/modjy/bugtests/test094.py branches/modjy/bugtests/test100.py branches/modjy/bugtests/test100j.java branches/modjy/bugtests/test101.py branches/modjy/bugtests/test104.py branches/modjy/bugtests/test114.py branches/modjy/bugtests/test116.py branches/modjy/bugtests/test117.py branches/modjy/bugtests/test117j.java branches/modjy/bugtests/test119.py branches/modjy/bugtests/test120.py branches/modjy/bugtests/test121.py branches/modjy/bugtests/test122.py branches/modjy/bugtests/test122p/ branches/modjy/bugtests/test123.py branches/modjy/bugtests/test123j.java branches/modjy/bugtests/test125m.py branches/modjy/bugtests/test129.py branches/modjy/bugtests/test129j.java branches/modjy/bugtests/test132.py branches/modjy/bugtests/test132j.java branches/modjy/bugtests/test132m.py branches/modjy/bugtests/test137.py branches/modjy/bugtests/test137j.java branches/modjy/bugtests/test145.py branches/modjy/bugtests/test146.py branches/modjy/bugtests/test147.py branches/modjy/bugtests/test148.py branches/modjy/bugtests/test149.py branches/modjy/bugtests/test150.py branches/modjy/bugtests/test151.py branches/modjy/bugtests/test152.py branches/modjy/bugtests/test153.py branches/modjy/bugtests/test154.py branches/modjy/bugtests/test154p/ branches/modjy/bugtests/test155.py branches/modjy/bugtests/test156.py branches/modjy/bugtests/test157.py branches/modjy/bugtests/test157j.java branches/modjy/bugtests/test158.py branches/modjy/bugtests/test159.py branches/modjy/bugtests/test160.py branches/modjy/bugtests/test161.py branches/modjy/bugtests/test162.py branches/modjy/bugtests/test162m.py branches/modjy/bugtests/test163.py branches/modjy/bugtests/test164.py branches/modjy/bugtests/test165.py branches/modjy/bugtests/test166.py branches/modjy/bugtests/test167.py branches/modjy/bugtests/test168.py branches/modjy/bugtests/test168p/ branches/modjy/bugtests/test169.py branches/modjy/bugtests/test169c.py branches/modjy/bugtests/test170.py branches/modjy/bugtests/test170p/ branches/modjy/bugtests/test171.py branches/modjy/bugtests/test171p/ branches/modjy/bugtests/test172.py branches/modjy/bugtests/test172j.java branches/modjy/bugtests/test173.py branches/modjy/bugtests/test173p/ branches/modjy/bugtests/test174.py branches/modjy/bugtests/test175.py branches/modjy/bugtests/test176.py branches/modjy/bugtests/test177.py branches/modjy/bugtests/test178.py branches/modjy/bugtests/test179.py branches/modjy/bugtests/test180.py branches/modjy/bugtests/test181.py branches/modjy/bugtests/test182.py branches/modjy/bugtests/test182c.py branches/modjy/bugtests/test183.py branches/modjy/bugtests/test184.py branches/modjy/bugtests/test184s1.py branches/modjy/bugtests/test184s2.py branches/modjy/bugtests/test185.html branches/modjy/bugtests/test185.py branches/modjy/bugtests/test185a.py branches/modjy/bugtests/test185m.py branches/modjy/bugtests/test186.html branches/modjy/bugtests/test186.py branches/modjy/bugtests/test186a.py branches/modjy/bugtests/test187.py branches/modjy/bugtests/test187c.py branches/modjy/bugtests/test188.py branches/modjy/bugtests/test188c.py branches/modjy/bugtests/test189.py branches/modjy/bugtests/test189c.py branches/modjy/bugtests/test190.py branches/modjy/bugtests/test190c.py branches/modjy/bugtests/test191.py branches/modjy/bugtests/test191c.py branches/modjy/bugtests/test192.html branches/modjy/bugtests/test192.py branches/modjy/bugtests/test192c.py branches/modjy/bugtests/test192c1.py branches/modjy/bugtests/test192c2.py branches/modjy/bugtests/test193.py branches/modjy/bugtests/test193c.py branches/modjy/bugtests/test194.html branches/modjy/bugtests/test194.py branches/modjy/bugtests/test194c.py branches/modjy/bugtests/test194m/ branches/modjy/bugtests/test195.py branches/modjy/bugtests/test195c.py branches/modjy/bugtests/test196.py branches/modjy/bugtests/test196c.py branches/modjy/bugtests/test197.py branches/modjy/bugtests/test197c.py branches/modjy/bugtests/test198.py branches/modjy/bugtests/test198c.py branches/modjy/bugtests/test199.py branches/modjy/bugtests/test199c.py branches/modjy/bugtests/test200.py branches/modjy/bugtests/test200p1.py branches/modjy/bugtests/test201.py branches/modjy/bugtests/test201c.py branches/modjy/bugtests/test202.py branches/modjy/bugtests/test203.py branches/modjy/bugtests/test204.py branches/modjy/bugtests/test205.py branches/modjy/bugtests/test206.py branches/modjy/bugtests/test207.py branches/modjy/bugtests/test208.py branches/modjy/bugtests/test209.py branches/modjy/bugtests/test209p/ branches/modjy/bugtests/test210.py branches/modjy/bugtests/test211.py branches/modjy/bugtests/test212.py branches/modjy/bugtests/test213.py branches/modjy/bugtests/test214.html branches/modjy/bugtests/test214.py branches/modjy/bugtests/test214a.py branches/modjy/bugtests/test215.py branches/modjy/bugtests/test216.py branches/modjy/bugtests/test216s1.py branches/modjy/bugtests/test217.py branches/modjy/bugtests/test217c.py branches/modjy/bugtests/test217t.java branches/modjy/bugtests/test218.py branches/modjy/bugtests/test218c.py branches/modjy/bugtests/test219.py branches/modjy/bugtests/test220.py branches/modjy/bugtests/test220c.py branches/modjy/bugtests/test221.py branches/modjy/bugtests/test221c.py branches/modjy/bugtests/test222.py branches/modjy/bugtests/test222s.py branches/modjy/bugtests/test223.py branches/modjy/bugtests/test223s.py branches/modjy/bugtests/test224.py branches/modjy/bugtests/test224s.py branches/modjy/bugtests/test225.py branches/modjy/bugtests/test225s.py branches/modjy/bugtests/test226.py branches/modjy/bugtests/test226c.py branches/modjy/bugtests/test227.py branches/modjy/bugtests/test227c.py branches/modjy/bugtests/test228.py branches/modjy/bugtests/test228s.py branches/modjy/bugtests/test229.py branches/modjy/bugtests/test229c.py branches/modjy/bugtests/test230.py branches/modjy/bugtests/test231.py branches/modjy/bugtests/test232.py branches/modjy/bugtests/test233.py branches/modjy/bugtests/test234.py branches/modjy/bugtests/test235.py branches/modjy/bugtests/test235p/ branches/modjy/bugtests/test237.py branches/modjy/bugtests/test237m1.py branches/modjy/bugtests/test237m2.py branches/modjy/bugtests/test238.py branches/modjy/bugtests/test239.py branches/modjy/bugtests/test240.py branches/modjy/bugtests/test242.py branches/modjy/bugtests/test242c.py branches/modjy/bugtests/test245.py branches/modjy/bugtests/test245j.java branches/modjy/bugtests/test246.py branches/modjy/bugtests/test246c.py branches/modjy/bugtests/test247.py branches/modjy/bugtests/test247j.java branches/modjy/bugtests/test248.py branches/modjy/bugtests/test249.py branches/modjy/bugtests/test249c.py branches/modjy/bugtests/test250.py branches/modjy/bugtests/test250j.java branches/modjy/bugtests/test251.py branches/modjy/bugtests/test251c.py branches/modjy/bugtests/test251c2.py branches/modjy/bugtests/test252.py branches/modjy/bugtests/test252c.py branches/modjy/bugtests/test252c2.py branches/modjy/bugtests/test253.py branches/modjy/bugtests/test253c.py branches/modjy/bugtests/test253c2.py branches/modjy/bugtests/test254.html branches/modjy/bugtests/test254.py branches/modjy/bugtests/test254c.py branches/modjy/bugtests/test255.py branches/modjy/bugtests/test255s1.py branches/modjy/bugtests/test255s2.py branches/modjy/bugtests/test256.html branches/modjy/bugtests/test256.py branches/modjy/bugtests/test256a.py branches/modjy/bugtests/test257.py branches/modjy/bugtests/test258.py branches/modjy/bugtests/test258m1.py branches/modjy/bugtests/test259.py branches/modjy/bugtests/test259s.py branches/modjy/bugtests/test260.py branches/modjy/bugtests/test261.py branches/modjy/bugtests/test261p/ branches/modjy/bugtests/test262.py branches/modjy/bugtests/test262m.py branches/modjy/bugtests/test262p/ branches/modjy/bugtests/test263.py branches/modjy/bugtests/test263m.py branches/modjy/bugtests/test264.py branches/modjy/bugtests/test264c.py branches/modjy/bugtests/test265.py branches/modjy/bugtests/test265j.java branches/modjy/bugtests/test266.py branches/modjy/bugtests/test268.py branches/modjy/bugtests/test268j1.java branches/modjy/bugtests/test268j2.java branches/modjy/bugtests/test269.py branches/modjy/bugtests/test269p/ branches/modjy/bugtests/test270.py branches/modjy/bugtests/test270p/ branches/modjy/bugtests/test271.py branches/modjy/bugtests/test272.py branches/modjy/bugtests/test272c.py branches/modjy/bugtests/test273.py branches/modjy/bugtests/test273p/ branches/modjy/bugtests/test274.py branches/modjy/bugtests/test275.py branches/modjy/bugtests/test275s.py branches/modjy/bugtests/test276.py branches/modjy/bugtests/test276j.java branches/modjy/bugtests/test277.py branches/modjy/bugtests/test277p/ branches/modjy/bugtests/test278.py branches/modjy/bugtests/test278p/ branches/modjy/bugtests/test280.py branches/modjy/bugtests/test280c.py branches/modjy/bugtests/test281.py branches/modjy/bugtests/test281c.py branches/modjy/bugtests/test282.py branches/modjy/bugtests/test284.py branches/modjy/bugtests/test284j1.java branches/modjy/bugtests/test284j2.java branches/modjy/bugtests/test285.py branches/modjy/bugtests/test286.py branches/modjy/bugtests/test286c.py branches/modjy/bugtests/test287.py branches/modjy/bugtests/test288.py branches/modjy/bugtests/test289.py branches/modjy/bugtests/test289c.py branches/modjy/bugtests/test290.py branches/modjy/bugtests/test291.py branches/modjy/bugtests/test292.policy branches/modjy/bugtests/test292.py branches/modjy/bugtests/test293.py branches/modjy/bugtests/test293p/ branches/modjy/bugtests/test294.py branches/modjy/bugtests/test294j.java branches/modjy/bugtests/test295.py branches/modjy/bugtests/test296.py branches/modjy/bugtests/test296p/ branches/modjy/bugtests/test297.py branches/modjy/bugtests/test297c.py branches/modjy/bugtests/test298.py branches/modjy/bugtests/test298m1.py branches/modjy/bugtests/test299.py branches/modjy/bugtests/test300.py branches/modjy/bugtests/test301.py branches/modjy/bugtests/test301c.py branches/modjy/bugtests/test302.py branches/modjy/bugtests/test303.py branches/modjy/bugtests/test303j.java branches/modjy/bugtests/test304.py branches/modjy/bugtests/test304m.py branches/modjy/bugtests/test307.py branches/modjy/bugtests/test307foobar.template branches/modjy/bugtests/test307m.template branches/modjy/bugtests/test307p.template branches/modjy/bugtests/test308.py branches/modjy/bugtests/test308d/ branches/modjy/bugtests/test309.py branches/modjy/bugtests/test310.py branches/modjy/bugtests/test310c.py branches/modjy/bugtests/test311.py branches/modjy/bugtests/test312.py branches/modjy/bugtests/test313.py branches/modjy/bugtests/test313c.py branches/modjy/bugtests/test314.py branches/modjy/bugtests/test314c.py branches/modjy/bugtests/test315.py branches/modjy/bugtests/test315c.py branches/modjy/bugtests/test316.py branches/modjy/bugtests/test317.py branches/modjy/bugtests/test317c.py branches/modjy/bugtests/test318.py branches/modjy/bugtests/test319.py branches/modjy/bugtests/test319j.java branches/modjy/bugtests/test320.py branches/modjy/bugtests/test366.py branches/modjy/bugtests/test373.py branches/modjy/bugtests/test389.py branches/modjy/bugtests/test391.py branches/modjy/bugtests/test395.py branches/modjy/bugtests/test396.py branches/modjy/extlibs/antlr-3.1.1-runtime.jar branches/modjy/extlibs/antlr-3.1.1.jar branches/modjy/extlibs/cpptasks/cpptasks.jar branches/modjy/extlibs/modjy_0_22_3.zip branches/modjy/src/org/python/compiler/pbc/Bytecode.java branches/modjy/src/org/python/compiler/pbc/BytecodeCompiler.java branches/modjy/src/org/python/core/APIReader.java branches/modjy/src/org/python/core/PySetIterator.java branches/modjy/tests/data/initializer/ branches/modjy/tests/data/initializer/META-INF/ branches/modjy/tests/data/initializer/META-INF/services/ branches/modjy/tests/data/initializer/META-INF/services/org.python.core.JythonInitializer branches/modjy/tests/data/initializer/SyspathAppendingInitializer.java branches/modjy/tests/java/javatests/MethodInvokationTest.java branches/modjy/tests/java/org/python/tests/inbred/Metis.java branches/modjy/tests/java/org/python/tests/inbred/Zeus.java branches/modjy/tests/java/org/python/tests/mro/ConfusedOnGetitemAdd.java branches/modjy/tests/java/org/python/tests/mro/ConfusedOnImport.java branches/modjy/tests/java/org/python/tests/mro/FirstAndPost.java branches/modjy/tests/java/org/python/tests/mro/FirstAndSecond.java branches/modjy/tests/java/org/python/tests/mro/FirstPredefinedGetitem.java branches/modjy/tests/java/org/python/tests/mro/GetitemAdder.java branches/modjy/tests/java/org/python/tests/mro/PostAndFirst.java branches/modjy/tests/java/org/python/tests/mro/PostdefinedGetitem.java branches/modjy/tests/java/org/python/tests/mro/SecondAndFirst.java branches/modjy/tests/java/org/python/tests/mro/SecondPredefinedGetitem.java Property Changed: ---------------- branches/modjy/ Property changes on: branches/modjy ___________________________________________________________________ Modified: svn:externals - CPythonLib http://svn.python.org/projects/python/branches/release25-maint/Lib/ + CPythonLib -r70085 http://svn.python.org/projects/python/branches/release25-maint/Lib/ Modified: svnmerge-integrated - /trunk/jython:1-5749 + /trunk/jython:1-6072 Modified: branches/modjy/.classpath =================================================================== --- branches/modjy/.classpath 2009-03-06 15:21:04 UTC (rev 6072) +++ branches/modjy/.classpath 2009-03-06 16:15:19 UTC (rev 6073) @@ -12,8 +12,10 @@ <classpathentry kind="lib" path="extlibs/mysql-connector-java-5.1.6.jar"/> <classpathentry kind="lib" path="extlibs/postgresql-8.3-603.jdbc4.jar"/> <classpathentry kind="lib" path="extlibs/servlet-api-2.5.jar"/> - <classpathentry kind="lib" path="build/jarjar"/> <classpathentry kind="var" path="ANT_HOME/lib/ant.jar"/> - <classpathentry kind="lib" path="extlibs/antlr-3.1.1-runtime.jar"/> + <classpathentry kind="lib" path="extlibs/antlr-runtime-3.1.2.jar"/> + <classpathentry kind="lib" path="extlibs/asm-3.1.jar"/> + <classpathentry kind="lib" path="extlibs/asm-commons-3.1.jar"/> + <classpathentry kind="lib" path="extlibs/constantine-0.4.jar"/> <classpathentry kind="output" path="bugtests/classes"/> </classpath> Modified: branches/modjy/CPythonLib.includes =================================================================== --- branches/modjy/CPythonLib.includes 2009-03-06 15:21:04 UTC (rev 6072) +++ branches/modjy/CPythonLib.includes 2009-03-06 16:15:19 UTC (rev 6073) @@ -8,6 +8,7 @@ encodings/** logging/* test/** +xml/etree/** # Lib files, in alphabetical order: __future__.py @@ -51,6 +52,8 @@ DocXMLRPCServer.py dospath.py dumbdbm.py +dummy_thread.py +dummy_threading.py exceptions.py fileinput.py fnmatch.py Modified: branches/modjy/CoreExposed.includes =================================================================== --- branches/modjy/CoreExposed.includes 2009-03-06 15:21:04 UTC (rev 6072) +++ branches/modjy/CoreExposed.includes 2009-03-06 16:15:19 UTC (rev 6073) @@ -1,4 +1,5 @@ org/python/core/AstList.class +org/python/core/ClasspathPyImporter.class org/python/core/PyArray.class org/python/core/PyBaseString.class org/python/core/PyBaseException.class @@ -33,6 +34,7 @@ org/python/core/PyStaticMethod.class org/python/core/PyString.class org/python/core/PySuper.class +org/python/core/PyTraceback.class org/python/core/PyTuple.class org/python/core/PyType.class org/python/core/PyUnicode.class Modified: branches/modjy/LICENSE.txt =================================================================== --- branches/modjy/LICENSE.txt 2009-03-06 15:21:04 UTC (rev 6072) +++ branches/modjy/LICENSE.txt 2009-03-06 16:15:19 UTC (rev 6073) @@ -53,7 +53,7 @@ Jython 2.0, 2.1 License ================================ -Copyright (c) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Jython Developers +Copyright (c) 2000-2009 Jython Developers. All rights reserved. Redistribution and use in source and binary forms, with or without Deleted: branches/modjy/Lib/asyncore.py =================================================================== --- branches/modjy/Lib/asyncore.py 2009-03-06 15:21:04 UTC (rev 6072) +++ branches/modjy/Lib/asyncore.py 2009-03-06 16:15:19 UTC (rev 6073) @@ -1,561 +0,0 @@ -# -*- Mode: Python -*- -# Id: asyncore.py,v 2.51 2000/09/07 22:29:26 rushing Exp -# Author: Sam Rushing <ru...@ni...> - -# ====================================================================== -# Copyright 1996 by Sam Rushing -# -# All Rights Reserved -# -# Permission to use, copy, modify, and distribute this software and -# its documentation for any purpose and without fee is hereby -# granted, provided that the above copyright notice appear in all -# copies and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of Sam -# Rushing not be used in advertising or publicity pertaining to -# distribution of the software without specific, written prior -# permission. -# -# SAM RUSHING DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN -# NO EVENT SHALL SAM RUSHING BE LIABLE FOR ANY SPECIAL, INDIRECT OR -# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS -# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, -# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN -# CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# ====================================================================== - -"""Basic infrastructure for asynchronous socket service clients and servers. - -There are only two ways to have a program on a single processor do "more -than one thing at a time". Multi-threaded programming is the simplest and -most popular way to do it, but there is another very different technique, -that lets you have nearly all the advantages of multi-threading, without -actually using multiple threads. it's really only practical if your program -is largely I/O bound. If your program is CPU bound, then pre-emptive -scheduled threads are probably what you really need. Network servers are -rarely CPU-bound, however. - -If your operating system supports the select() system call in its I/O -library (and nearly all do), then you can use it to juggle multiple -communication channels at once; doing other work while your I/O is taking -place in the "background." Although this strategy can seem strange and -complex, especially at first, it is in many ways easier to understand and -control than multi-threaded programming. The module documented here solves -many of the difficult problems for you, making the task of building -sophisticated high-performance network servers and clients a snap. -""" - -import exceptions -import select -import socket -import sys -import time - -import os -from errno import EALREADY, EINPROGRESS, EWOULDBLOCK, ECONNRESET, \ - ENOTCONN, ESHUTDOWN, EINTR, EISCONN - -try: - socket_map -except NameError: - socket_map = {} - -class ExitNow(exceptions.Exception): - pass - -def read(obj): - try: - obj.handle_read_event() - except ExitNow: - raise - except: - obj.handle_error() - -def write(obj): - try: - obj.handle_write_event() - except ExitNow: - raise - except: - obj.handle_error() - -def readwrite(obj, flags): - try: - if flags & select.POLLIN: - obj.handle_read_event() - if flags & select.POLLOUT: - obj.handle_write_event() - except ExitNow: - raise - except: - obj.handle_error() - -def poll(timeout=0.0, map=None): - if map is None: - map = socket_map - if map: - r = []; w = []; e = [] - for fd, obj in map.items(): - if obj.readable(): - r.append(fd) - if obj.writable(): - w.append(fd) - if [] == r == w == e: - time.sleep(timeout) - else: - try: - r, w, e = select.select(r, w, e, timeout) - except select.error, err: - if err[0] != EINTR: - raise - else: - return - - for fd in r: - obj = map.get(fd) - if obj is None: - continue - read(obj) - - for fd in w: - obj = map.get(fd) - if obj is None: - continue - write(obj) - -def poll2(timeout=0.0, map=None): - import poll - if map is None: - map = socket_map - if timeout is not None: - # timeout is in milliseconds - timeout = int(timeout*1000) - if map: - l = [] - for fd, obj in map.items(): - flags = 0 - if obj.readable(): - flags = poll.POLLIN - if obj.writable(): - flags = flags | poll.POLLOUT - if flags: - l.append((fd, flags)) - r = poll.poll(l, timeout) - for fd, flags in r: - obj = map.get(fd) - if obj is None: - continue - readwrite(obj, flags) - -def poll3(timeout=0.0, map=None): - # Use the poll() support added to the select module in Python 2.0 - if map is None: - map = socket_map - if timeout is not None: - # timeout is in milliseconds - timeout = int(timeout*1000) - pollster = select.poll() - if map: - for fd, obj in map.items(): - flags = 0 - if obj.readable(): - flags = select.POLLIN - if obj.writable(): - flags = flags | select.POLLOUT - if flags: - pollster.register(fd, flags) - try: - r = pollster.poll(timeout) - except select.error, err: - if err[0] != EINTR: - raise - r = [] - for fd, flags in r: - obj = map.get(fd) - if obj is None: - continue - readwrite(obj, flags) - -def loop(timeout=30.0, use_poll=0, map=None): - if map is None: - map = socket_map - - if use_poll: - if hasattr(select, 'poll'): - poll_fun = poll3 - else: - poll_fun = poll2 - else: - poll_fun = poll - - while map: - poll_fun(timeout, map) - -class dispatcher: - - debug = 0 - connected = 0 - accepting = 0 - closing = 0 - addr = None - - def __init__(self, sock=None, map=None): - if sock: - self.set_socket(sock, map) - # I think it should inherit this anyway - self.socket.setblocking(0) - self.connected = 1 - # XXX Does the constructor require that the socket passed - # be connected? - try: - self.addr = sock.getpeername() - except socket.error: - # The addr isn't crucial - pass - else: - self.socket = None - - def __repr__(self): - status = [self.__class__.__module__+"."+self.__class__.__name__] - if self.accepting and self.addr: - status.append('listening') - elif self.connected: - status.append('connected') - if self.addr is not None: - try: - status.append('%s:%d' % self.addr) - except TypeError: - status.append(repr(self.addr)) - # On some systems (RH10) id() can be a negative number. - # work around this. - MAX = 2L*sys.maxint+1 - return '<%s at %#x>' % (' '.join(status), id(self)&MAX) - - def add_channel(self, map=None): - #self.log_info('adding channel %s' % self) - if map is None: - if hasattr(self, '_map'): - map = self._map - del self._map - else: - map = socket_map - if not hasattr(self, '_fileno'): - self._fileno = self.socket.fileno() - map[self._fileno] = self - - def del_channel(self, map=None): - fd = self._fileno - if map is None: - map = socket_map - if map.has_key(fd): - #self.log_info('closing channel %d:%s' % (fd, self)) - del map[fd] - - def create_socket(self, family, type): - self.family_and_type = family, type - self.socket = socket.socket(family, type) - self.socket.setblocking(0) - - def set_socket(self, sock, map=None): - self.socket = sock -## self.__dict__['socket'] = sock - if sock.fileno(): - self.add_channel(map) - else: - self._map = map - - def set_reuse_addr(self): - # try to re-use a server port if possible - try: - self.socket.setsockopt( - socket.SOL_SOCKET, socket.SO_REUSEADDR, - self.socket.getsockopt(socket.SOL_SOCKET, - socket.SO_REUSEADDR) | 1 - ) - except socket.error: - pass - - # ================================================== - # predicates for select() - # these are used as filters for the lists of sockets - # to pass to select(). - # ================================================== - - def readable(self): - return True - - if os.name == 'mac': - # The macintosh will select a listening socket for - # write if you let it. What might this mean? - def writable(self): - return not self.accepting - else: - def writable(self): - return True - - # ================================================== - # socket object methods. - # ================================================== - - def listen(self, num): - self.accepting = 1 - if os.name == 'nt' and num > 5: - num = 1 - ret = self.socket.listen(num) - self.add_channel() - return ret - - def bind(self, addr): - self.addr = addr - return self.socket.bind(addr) - - def connect(self, address): - self.connected = 0 - err = self.socket.connect_ex(address) - # XXX Should interpret Winsock return values - if err in (EINPROGRESS, EALREADY, EWOULDBLOCK): - return - if err in (0, EISCONN): - self.add_channel() - self.addr = address - self.connected = 1 - self.handle_connect() - else: - raise socket.error, err - - def accept(self): - # XXX can return either an address pair or None - try: - conn, addr = self.socket.accept() - self.add_channel() - return conn, addr - except socket.error, why: - if why[0] == EWOULDBLOCK: - pass - else: - raise socket.error, why - - def send(self, data): - try: - result = self.socket.send(data) - return result - except socket.error, why: - if why[0] == EWOULDBLOCK: - return 0 - else: - raise socket.error, why - return 0 - - def recv(self, buffer_size): - try: - data = self.socket.recv(buffer_size) - if not data: - # a closed connection is indicated by signaling - # a read condition, and having recv() return 0. - self.handle_close() - return '' - else: - return data - except socket.error, why: - # winsock sometimes throws ENOTCONN - if why[0] in [ECONNRESET, ENOTCONN, ESHUTDOWN]: - self.handle_close() - return '' - else: - raise socket.error, why - - def close(self): - self.del_channel() - self.socket.close() - - # cheap inheritance, used to pass all other attribute - # references to the underlying socket object. - def __getattr__(self, attr): - return getattr(self.socket, attr) - - # log and log_info may be overridden to provide more sophisticated - # logging and warning methods. In general, log is for 'hit' logging - # and 'log_info' is for informational, warning and error logging. - - def log(self, message): - sys.stderr.write('log: %s\n' % str(message)) - - def log_info(self, message, type='info'): - if __debug__ or type != 'info': - print '%s: %s' % (type, message) - - def handle_read_event(self): - if self.accepting: - # for an accepting socket, getting a read implies - # that we are connected - if not self.connected: - self.connected = 1 - self.handle_accept() - elif not self.connected: - self.handle_connect() - self.connected = 1 - self.handle_read() - else: - self.handle_read() - - def handle_write_event(self): - # getting a write implies that we are connected - if not self.connected: - self.handle_connect() - self.connected = 1 - self.handle_write() - - def handle_expt_event(self): - self.handle_expt() - - def handle_error(self): - nil, t, v, tbinfo = compact_traceback() - - # sometimes a user repr method will crash. - try: - self_repr = repr(self) - except: - self_repr = '<__repr__(self) failed for object at %0x>' % id(self) - - self.log_info( - 'uncaptured python exception, closing channel %s (%s:%s %s)' % ( - self_repr, - t, - v, - tbinfo - ), - 'error' - ) - self.close() - - def handle_expt(self): - self.log_info('unhandled exception', 'warning') - - def handle_read(self): - self.log_info('unhandled read event', 'warning') - - def handle_write(self): - self.log_info('unhandled write event', 'warning') - - def handle_connect(self): - self.log_info('unhandled connect event', 'warning') - - def handle_accept(self): - self.log_info('unhandled accept event', 'warning') - - def handle_close(self): - self.log_info('unhandled close event', 'warning') - self.close() - -# --------------------------------------------------------------------------- -# adds simple buffered output capability, useful for simple clients. -# [for more sophisticated usage use asynchat.async_chat] -# --------------------------------------------------------------------------- - -class dispatcher_with_send(dispatcher): - - def __init__(self, sock=None): - dispatcher.__init__(self, sock) - self.out_buffer = '' - - def initiate_send(self): - num_sent = 0 - num_sent = dispatcher.send(self, self.out_buffer[... [truncated message content] |
From: <fwi...@us...> - 2009-03-06 15:21:13
|
Revision: 6072 http://jython.svn.sourceforge.net/jython/?rev=6072&view=rev Author: fwierzbicki Date: 2009-03-06 15:21:04 +0000 (Fri, 06 Mar 2009) Log Message: ----------- Initialized merge tracking via "svnmerge" with revisions "1-5749" from https://jython.svn.sourceforge.net/svnroot/jython/trunk/jython Property Changed: ---------------- branches/modjy/ Property changes on: branches/modjy ___________________________________________________________________ Added: svnmerge-integrated + /trunk/jython:1-5749 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fwi...@us...> - 2009-03-06 04:15:56
|
Revision: 6071 http://jython.svn.sourceforge.net/jython/?rev=6071&view=rev Author: fwierzbicki Date: 2009-03-06 04:15:54 +0000 (Fri, 06 Mar 2009) Log Message: ----------- Added mtime to the compiled Jython classes to match CPython behavior. Fixes: http://bugs.jython.org/issue1567212 and http://bugs.jython.org/issue1024 Modified Paths: -------------- trunk/jython/src/org/python/compiler/ClassFile.java trunk/jython/src/org/python/compiler/Module.java trunk/jython/src/org/python/core/imp.java trunk/jython/src/org/python/modules/imp.java Added Paths: ----------- trunk/jython/Lib/test/test_compile_jy.py trunk/jython/src/org/python/compiler/MTime.java trunk/jython/src/org/python/core/AnnotationReader.java Removed Paths: ------------- trunk/jython/src/org/python/core/APIReader.java Added: trunk/jython/Lib/test/test_compile_jy.py =================================================================== --- trunk/jython/Lib/test/test_compile_jy.py (rev 0) +++ trunk/jython/Lib/test/test_compile_jy.py 2009-03-06 04:15:54 UTC (rev 6071) @@ -0,0 +1,57 @@ +import unittest +import os +import sys +import shutil +import __builtin__ +import py_compile +from test.test_support import run_unittest, TESTFN, is_jython + +class TestMtime(unittest.TestCase): + + def test_mtime_compile(self): + """ + This test exercises the mtime annotation that is now stored in Jython + compiled files. CPython already stores an mtime in its pyc files. To + exercise this functionality, I am writing a py file, compiling it, + setting the os modified time to a very low value on the compiled file, + then changing the py file after a small sleep. On CPython, this would + still cause a re-compile. In Jython before this fix it would not. + See http://bugs.jython.org/issue1024 + """ + + import time + os.mkdir(TESTFN) + try: + mod = "mod1" + source_path = os.path.join(TESTFN, "%s.py" % mod) + if is_jython: + compiled_path = os.path.join(TESTFN, "%s$py.class" % mod) + else: + compiled_path = os.path.join(TESTFN, "%s.pyc" % mod) + fp = open(source_path, "w") + fp.write("def foo(): return 'first'\n") + fp.close() + py_compile.compile(source_path) + + #sleep so that the internal mtime is older for the next source write. + time.sleep(1) + + fp = open(source_path, "w") + fp.write("def foo(): return 'second'\n") + fp.close() + + # make sure the source file's mtime is artificially younger than + # the compiled path's mtime. + os.utime(source_path, (1,1)) + + sys.path.append(TESTFN) + import mod1 + self.assertEquals(mod1.foo(), 'second') + finally: + shutil.rmtree(TESTFN) + +def test_main(): + run_unittest(TestMtime) + +if __name__ == "__main__": + test_main() Modified: trunk/jython/src/org/python/compiler/ClassFile.java =================================================================== --- trunk/jython/src/org/python/compiler/ClassFile.java 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/src/org/python/compiler/ClassFile.java 2009-03-06 04:15:54 UTC (rev 6071) @@ -19,6 +19,7 @@ { ClassWriter cw; int access; + long mtime; public String name; String superclass; String sfilename; @@ -37,14 +38,19 @@ } public ClassFile(String name) { - this(name, "java/lang/Object", Opcodes.ACC_SYNCHRONIZED | Opcodes.ACC_PUBLIC); + this(name, "java/lang/Object", Opcodes.ACC_SYNCHRONIZED | Opcodes.ACC_PUBLIC, + org.python.core.imp.NO_MTIME); } public ClassFile(String name, String superclass, int access) { + this(name, superclass, access, org.python.core.imp.NO_MTIME); + } + public ClassFile(String name, String superclass, int access, long mtime) { this.name = fixName(name); this.superclass = fixName(superclass); this.interfaces = new String[0]; this.access = access; + this.mtime = mtime; cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES); methodVisitors = Collections.synchronizedList(new ArrayList()); @@ -103,6 +109,10 @@ av.visit("value", new Integer(org.python.core.imp.APIVersion)); av.visitEnd(); + av = cw.visitAnnotation("Lorg/python/compiler/MTime;", true); + av.visit("value", new Long(mtime)); + av.visitEnd(); + if (sfilename != null) { cw.visitSource(sfilename, null); } Added: trunk/jython/src/org/python/compiler/MTime.java =================================================================== --- trunk/jython/src/org/python/compiler/MTime.java (rev 0) +++ trunk/jython/src/org/python/compiler/MTime.java 2009-03-06 04:15:54 UTC (rev 6071) @@ -0,0 +1,13 @@ +/* + * Copyright (c) 2008 Jython Developers + * Licensed to PSF under a Contributor Agreement. + */ +package org.python.compiler; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + +@Retention(RetentionPolicy.RUNTIME) +public @interface MTime { + long value(); +} Modified: trunk/jython/src/org/python/compiler/Module.java =================================================================== --- trunk/jython/src/org/python/compiler/Module.java 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/src/org/python/compiler/Module.java 2009-03-06 04:15:54 UTC (rev 6071) @@ -296,11 +296,17 @@ public boolean linenumbers; Future futures; Hashtable scopes; + long mtime; public Module(String name, String filename, boolean linenumbers) { + this(name, filename, linenumbers, org.python.core.imp.NO_MTIME); + } + + public Module(String name, String filename, boolean linenumbers, long mtime) { this.linenumbers = linenumbers; + this.mtime = mtime; classfile = new ClassFile(name, "org/python/core/PyFunctionTable", - ACC_SYNCHRONIZED | ACC_PUBLIC); + ACC_SYNCHRONIZED | ACC_PUBLIC, mtime); constants = new Hashtable(); sfilename = filename; if (filename != null) @@ -313,7 +319,7 @@ } public Module(String name) { - this(name, name+".py", true); + this(name, name+".py", true, org.python.core.imp.NO_MTIME); } // This block of code handles the pool of Python Constants @@ -633,14 +639,22 @@ } throw new ParseException(msg,node); } + public static void compile(mod node, OutputStream ostream, + String name, String filename, + boolean linenumbers, boolean printResults, + CompilerFlags cflags) + throws Exception + { + compile(node, ostream, name, filename, linenumbers, printResults, cflags, org.python.core.imp.NO_MTIME); + } public static void compile(mod node, OutputStream ostream, String name, String filename, boolean linenumbers, boolean printResults, - CompilerFlags cflags) + CompilerFlags cflags, long mtime) throws Exception { - Module module = new Module(name, filename, linenumbers); + Module module = new Module(name, filename, linenumbers, mtime); if (cflags == null) { cflags = new CompilerFlags(); } Deleted: trunk/jython/src/org/python/core/APIReader.java =================================================================== --- trunk/jython/src/org/python/core/APIReader.java 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/src/org/python/core/APIReader.java 2009-03-06 04:15:54 UTC (rev 6071) @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2008 Jython Developers - * Licensed to PSF under a Contributor Agreement. - */ -package org.python.core; - -import java.io.IOException; - -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.commons.EmptyVisitor; - -/** - * This class reads a classfile from a byte array and pulls out the value of the class annotation - * for APIVersion, which can then be retrieved by a call to getVersion(). - * - * Hopefully the use of ClassReader in this implementation is not too expensive. I suspect it is not - * since EmptyVisitor is just a bag of empty methods so shouldn't cost too much. If it turns out to - * cost too much, we will want to implement a special purpose ClassReader that only reads out the - * APIVersion annotation I think. - */ -public class APIReader extends EmptyVisitor { - - private boolean nextVisitIsVersion = false; - - private int version = -1; - - /** - * Reads the classfile bytecode in data and to extract the version. - * @throws IOException - if the classfile is malformed. - */ - public APIReader(byte[] data) throws IOException { - ClassReader r; - try { - r = new ClassReader(data); - } catch (ArrayIndexOutOfBoundsException e) { - IOException ioe = new IOException("Malformed bytecode: not enough data"); - ioe.initCause(e);// IOException didn't grow a constructor that could take a cause till - // 1.6, so do it the old fashioned way - throw ioe; - } - r.accept(this, 0); - } - - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - nextVisitIsVersion = desc.equals("Lorg/python/compiler/APIVersion;"); - return this; - } - - public void visit(String name, Object value) { - if (nextVisitIsVersion) { - version = (Integer)value; - nextVisitIsVersion = false; - } - } - - public int getVersion() { - return version; - } -} Copied: trunk/jython/src/org/python/core/AnnotationReader.java (from rev 6064, trunk/jython/src/org/python/core/APIReader.java) =================================================================== --- trunk/jython/src/org/python/core/AnnotationReader.java (rev 0) +++ trunk/jython/src/org/python/core/AnnotationReader.java 2009-03-06 04:15:54 UTC (rev 6071) @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2008 Jython Developers + * Licensed to PSF under a Contributor Agreement. + */ +package org.python.core; + +import java.io.IOException; + +import org.objectweb.asm.AnnotationVisitor; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.commons.EmptyVisitor; + +/** + * This class reads a classfile from a byte array and pulls out the value of the class annotation + * for APIVersion, which can then be retrieved by a call to getVersion(). + * + * Hopefully the use of ClassReader in this implementation is not too expensive. I suspect it is not + * since EmptyVisitor is just a bag of empty methods so shouldn't cost too much. If it turns out to + * cost too much, we will want to implement a special purpose ClassReader that only reads out the + * APIVersion annotation I think. + */ +public class AnnotationReader extends EmptyVisitor { + + private boolean nextVisitIsVersion = false; + private boolean nextVisitIsMTime = false; + + private int version = -1; + private long mtime = -1; + + /** + * Reads the classfile bytecode in data and to extract the version. + * @throws IOException - if the classfile is malformed. + */ + public AnnotationReader(byte[] data) throws IOException { + ClassReader r; + try { + r = new ClassReader(data); + } catch (ArrayIndexOutOfBoundsException e) { + IOException ioe = new IOException("Malformed bytecode: not enough data"); + ioe.initCause(e);// IOException didn't grow a constructor that could take a cause till + // 1.6, so do it the old fashioned way + throw ioe; + } + r.accept(this, 0); + } + + public AnnotationVisitor visitAnnotation(String desc, boolean visible) { + nextVisitIsVersion = desc.equals("Lorg/python/compiler/APIVersion;"); + nextVisitIsMTime = desc.equals("Lorg/python/compiler/MTime;"); + return this; + } + + public void visit(String name, Object value) { + if (nextVisitIsVersion) { + version = (Integer)value; + nextVisitIsVersion = false; + } else if (nextVisitIsMTime) { + mtime = (Long)value; + nextVisitIsVersion = false; + } + } + + public int getVersion() { + return version; + } + + public long getMTime() { + return mtime; + } +} Modified: trunk/jython/src/org/python/core/imp.java =================================================================== --- trunk/jython/src/org/python/core/imp.java 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/src/org/python/core/imp.java 2009-03-06 04:15:54 UTC (rev 6071) @@ -22,6 +22,8 @@ public static final int APIVersion = 17; + public static final int NO_MTIME = -1; + // This should change to 0 for Python 2.7 and 3.0 see PEP 328 public static final int DEFAULT_LEVEL = -1; @@ -85,12 +87,17 @@ throw Py.IOError(ioe); } } + static PyObject createFromPyClass(String name, InputStream fp, boolean testing, + String sourceName, String compiledName) { + return createFromPyClass(name, fp, testing, sourceName, compiledName, NO_MTIME); + } + static PyObject createFromPyClass(String name, InputStream fp, boolean testing, - String sourceName, String compiledName) { + String sourceName, String compiledName, long mtime) { byte[] data = null; try { - data = readCode(name, fp, testing); + data = readCode(name, fp, testing, mtime); } catch (IOException ioe) { if (!testing) { throw Py.ImportError(ioe.getMessage() + "[name=" + name + ", source=" + sourceName @@ -118,9 +125,13 @@ } public static byte[] readCode(String name, InputStream fp, boolean testing) throws IOException { + return readCode(name, fp, testing, NO_MTIME); + } + + public static byte[] readCode(String name, InputStream fp, boolean testing, long mtime) throws IOException { byte[] data = readBytes(fp); int api; - APIReader ar = new APIReader(data); + AnnotationReader ar = new AnnotationReader(data); api = ar.getVersion(); if (api != APIVersion) { if (testing) { @@ -130,6 +141,12 @@ + APIVersion + ") in: " + name); } } + if (testing && mtime != NO_MTIME) { + long time = ar.getMTime(); + if (mtime != time) { + return null; + } + } return data; } @@ -146,7 +163,8 @@ if (sourceFilename == null) { sourceFilename = file.toString(); } - return compileSource(name, makeStream(file), sourceFilename); + long mtime = file.lastModified(); + return compileSource(name, makeStream(file), sourceFilename, mtime); } public static String makeCompiledFilename(String filename) { @@ -199,6 +217,10 @@ } public static byte[] compileSource(String name, InputStream fp, String filename) { + return compileSource(name, fp, filename, NO_MTIME); + } + + public static byte[] compileSource(String name, InputStream fp, String filename, long mtime) { ByteArrayOutputStream ofp = new ByteArrayOutputStream(); try { if(filename == null) { @@ -210,7 +232,7 @@ } finally { fp.close(); } - Module.compile(node, ofp, name + "$py", filename, true, false, null); + Module.compile(node, ofp, name + "$py", filename, true, false, null, mtime); return ofp.toByteArray(); } catch(Throwable t) { throw ParserFacade.fixParseError(null, t, filename); @@ -218,12 +240,17 @@ } public static PyObject createFromSource(String name, InputStream fp, String filename) { - return createFromSource(name, fp, filename, null); + return createFromSource(name, fp, filename, null, NO_MTIME); } public static PyObject createFromSource(String name, InputStream fp, String filename, String outFilename) { - byte[] bytes = compileSource(name, fp, filename); + return createFromSource(name, fp, filename, outFilename, NO_MTIME); + } + + public static PyObject createFromSource(String name, InputStream fp, + String filename, String outFilename, long mtime) { + byte[] bytes = compileSource(name, fp, filename, mtime); outFilename = cacheCompiledSource(filename, outFilename, bytes); Py.writeComment(IMPORT_LOG, "'" + name + "' as " + filename); @@ -433,20 +460,20 @@ } if (sourceFile.isFile() && caseok(sourceFile, sourceName)) { + long pyTime = sourceFile.lastModified(); if (compiledFile.isFile() && caseok(compiledFile, compiledName)) { Py.writeDebug(IMPORT_LOG, "trying precompiled " + compiledFile.getPath()); - long pyTime = sourceFile.lastModified(); long classTime = compiledFile.lastModified(); if (classTime >= pyTime) { PyObject ret = createFromPyClass(modName, makeStream(compiledFile), true, - displaySourceName, displayCompiledName); + displaySourceName, displayCompiledName, pyTime); if (ret != null) { return ret; } } } return createFromSource(modName, makeStream(sourceFile), displaySourceName, - compiledFile.getPath()); + compiledFile.getPath(), pyTime); } // If no source, try loading precompiled Modified: trunk/jython/src/org/python/modules/imp.java =================================================================== --- trunk/jython/src/org/python/modules/imp.java 2009-03-05 22:07:35 UTC (rev 6070) +++ trunk/jython/src/org/python/modules/imp.java 2009-03-06 04:15:54 UTC (rev 6071) @@ -207,10 +207,18 @@ } else if (name.equals("__init__")) { name = new File(sys.getCurrentWorkingDir()).getName(); } + + File fp = new File(resolvedFilename); + long mtime = -1; + if (fp.isFile()) { + mtime = fp.lastModified(); + } + mod = org.python.core.imp.createFromSource(name.intern(), (InputStream)o, filename.toString(), - compiledName); + compiledName, + mtime); break; case PY_COMPILED: compiledName = filename.toString(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <am...@us...> - 2009-03-05 22:07:40
|
Revision: 6070 http://jython.svn.sourceforge.net/jython/?rev=6070&view=rev Author: amak Date: 2009-03-05 22:07:35 +0000 (Thu, 05 Mar 2009) Log Message: ----------- Committing the unit tests. There is a readme.txt file in the directory which explains how to run the tests, which depend on mockrunner. Added Paths: ----------- branches/modjy/tests/modjy/ branches/modjy/tests/modjy/__init__.py branches/modjy/tests/modjy/build.xml branches/modjy/tests/modjy/empty.txt branches/modjy/tests/modjy/java/ branches/modjy/tests/modjy/java/com/ branches/modjy/tests/modjy/java/com/xhaus/ branches/modjy/tests/modjy/java/com/xhaus/modjy/ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestAppInvocation.java branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestBase.java branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestContentHeaders.java branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestEnviron.java branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestHeaders.java branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestReturnIterable.java branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWSGIStreams.java branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWebInf.java branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWriteCallable.java branches/modjy/tests/modjy/lib_python_folder/ branches/modjy/tests/modjy/lib_python_folder/__init__.py branches/modjy/tests/modjy/lib_python_folder/add_zips.pth branches/modjy/tests/modjy/lib_python_folder/do_import.pth branches/modjy/tests/modjy/lib_python_folder/mock_framework/ branches/modjy/tests/modjy/lib_python_folder/mock_framework/__init__.py branches/modjy/tests/modjy/lib_python_folder/mock_framework/web/ branches/modjy/tests/modjy/lib_python_folder/mock_framework/web/__init__.py branches/modjy/tests/modjy/lib_python_folder/mock_framework/web/handlers/ branches/modjy/tests/modjy/lib_python_folder/mock_framework/web/handlers/__init__.py branches/modjy/tests/modjy/lib_python_folder/mock_framework/web/handlers/wsgi_handlers.py branches/modjy/tests/modjy/lib_python_folder/script_name_path_info.py branches/modjy/tests/modjy/lib_python_folder/test_lib/ branches/modjy/tests/modjy/lib_python_folder/test_lib/__init__.py branches/modjy/tests/modjy/lib_python_folder/test_lib/some_libs.py branches/modjy/tests/modjy/lib_python_folder/test_modules.zip branches/modjy/tests/modjy/lines.txt branches/modjy/tests/modjy/readme.txt branches/modjy/tests/modjy/test_apps_dir/ branches/modjy/tests/modjy/test_apps_dir/__init__.py branches/modjy/tests/modjy/test_apps_dir/content_header_tests.py branches/modjy/tests/modjy/test_apps_dir/environ_tests.py branches/modjy/tests/modjy/test_apps_dir/header_tests.py branches/modjy/tests/modjy/test_apps_dir/return_tests.py branches/modjy/tests/modjy/test_apps_dir/simple_app.py branches/modjy/tests/modjy/test_apps_dir/stream_tests.py branches/modjy/tests/modjy/test_apps_dir/web_inf_tests.py Added: branches/modjy/tests/modjy/build.xml =================================================================== --- branches/modjy/tests/modjy/build.xml (rev 0) +++ branches/modjy/tests/modjy/build.xml 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,109 @@ +<project name="modjy" default="test"> + + <description>Modjy test build.xml</description> + + <!-- set global properties for this build --> + + <property name="test_src" location="java"/> + <property name="build" location="build"/> + + <!-- Import the environment --> + <property environment="env"/> + + <!-- Jython properties --> + + <property name="jython_home" location="${env.JYTHON_HOME}"/> + <property name="jython_jar" value="jython.jar"/> + <property name="jython_jar_path" location="${jython_home}/${jython_jar}"/> + <property name="jython_cachedir" location="${jython_home}/cachedir"/> + + <target name="init"> + <available property="jython.home.set" file="${env.JYTHON_HOME}" /> + <fail unless="jython.home.set" message="JYTHON_HOME not set" /> + <available property="mockrunner.home.set" file="${env.MOCKRUNNER_HOME}" /> + <fail unless="mockrunner.home.set" message="MOCKRUNNER_HOME not set" /> + <!-- Create the build directory structure used by compile --> + <mkdir dir="${build}"/> + </target> + + <target name="clean" description="clean up" > + <!-- Delete the ${build} and ${dist} directory trees --> + <delete dir="${build}"/> + </target> + + <!-- Now testing related targets --> + + <target name="do_test" depends="init" description="Run unit tests against a single jdk/servlet combo"> + <echo message="Running tests against JDK ${jdk_version}, Servlet ${servlet_version}"/> + <echo message="Clearing jython package cache located at ${jython_home}/cachedir"/> + + <delete quiet="true"> + <fileset dir="${jython_cachedir}"/> + </delete> + + <property name="mockrunner_home" value="${env.MOCKRUNNER_HOME}"/> + <property name="mockrunner_jar" location="${mockrunner_home}/jar"/> + <property name="mockrunner_lib" location="${mockrunner_home}/lib/jdk${jdk_version}/${servlet_version}"/> + + <path id="test.classpath"> + <pathelement path="${build}"/> + <pathelement path="${jython_jar_path}"/> + <fileset dir="${jython_home}/javalib" includes="**/*.jar"/> + <fileset dir="${mockrunner_jar}" includes="**/*.jar"/> + <fileset dir="${mockrunner_lib}" includes="**/*.jar"/> + </path> + + <javac + srcdir="${test_src}" + destdir="${build}" + classpathref="test.classpath" + debug="on" + /> + + <java + classname="com.xhaus.modjy.ModjyTestBase" + dir="." + fork="yes" + classpathref="test.classpath" + /> + </target> + + <target name="test"> + <antcall target="do_test"> + <param name="jdk_version" value="1.5"/> + <param name="servlet_version" value="j2ee1.3"/> + </antcall> + </target> + + <target name="test_java_15" depends="clean"> + <antcall target="do_test"> + <param name="jdk_version" value="1.5"/> + <param name="servlet_version" value="j2ee1.3"/> + </antcall> + <antcall target="do_test"> + <param name="jdk_version" value="1.5"/> + <param name="servlet_version" value="j2ee1.4"/> + </antcall> + <antcall target="do_test"> + <param name="jdk_version" value="1.5"/> + <param name="servlet_version" value="jee5"/> + </antcall> + </target> + + <target name="test_java_16" depends="clean"> + <antcall target="do_test"> + <param name="jdk_version" value="1.6"/> + <param name="servlet_version" value="j2ee1.3"/> + </antcall> + <antcall target="do_test"> + <param name="jdk_version" value="1.6"/> + <param name="servlet_version" value="j2ee1.4"/> + </antcall> + <antcall target="do_test"> + <param name="jdk_version" value="1.6"/> + <param name="servlet_version" value="jee5"/> + </antcall> + </target> + +</project> + Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestAppInvocation.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestAppInvocation.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestAppInvocation.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,224 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +import java.io.File; + +import org.python.core.PyDictionary; +import org.python.core.PyInteger; +import org.python.core.PyObject; +import org.python.core.PyString; +import org.python.core.PyTuple; + +public class ModjyTestAppInvocation extends ModjyTestBase +{ + + protected void appInvocationTestSetUp() + throws Exception + { + baseSetUp(); + setAppDir(""); + setAppFile(""); + setAppName(""); + setAppImportable(""); + } + + String[] importablepathElements = new String[] { + "mock_framework", + "web", + "handlers", + "wsgi_handlers", + }; + + public void testRelativeDirectory ( ) + throws Exception + { + baseSetUp(); + setRealPath("/test_apps_dir", "test_apps_dir"); + setAppDir("$/test_apps_dir"); + setAppFile("simple_app.py"); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("Hello World!", result); + } + + public String setupAppImport ( String appCallableName ) + throws Exception + { + StringBuffer filePathBuffer = new StringBuffer(); + StringBuffer importPath = new StringBuffer(); + for (int ix = 0 ; ix < importablepathElements.length ; ix++) + { + String resourcePath; + String filePath; + filePathBuffer.append(importablepathElements[ix]); + resourcePath = "/WEB-INF/"+LIB_PYTHON_DIR+"/"+filePathBuffer.toString(); + filePath = LIB_PYTHON_TEST_PATH+"/"+filePathBuffer.toString(); + setRealPath(resourcePath, filePath); + filePathBuffer.append("/"); + resourcePath = "/WEB-INF/"+LIB_PYTHON_DIR+"/"+filePathBuffer.toString()+"__init__.py"; + filePath = LIB_PYTHON_TEST_PATH+"/"+filePathBuffer.toString()+"__init__.py"; + setRealPath(resourcePath, filePath); + importPath.append(importablepathElements[ix]); + importPath.append("."); + } + importPath.append(appCallableName); + return importPath.toString(); + } + + public void testAppImportCallable ( ) + throws Exception + { + appInvocationTestSetUp(); + String importableName = setupAppImport("WSGIHandlerFunction"); + setAppImportable(importableName); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("WSGIHandlerFunction called.", result); + } + + public void testAppImportBadInstantiable ( ) + throws Exception + { + appInvocationTestSetUp(); + String importableName = setupAppImport("WSGIHandlerClass"); + setAppImportable(importableName); + createServlet(); + doGet(); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + } + + public void testAppImportInstantiable ( ) + throws Exception + { + appInvocationTestSetUp(); + String importableName = setupAppImport("WSGIHandlerClass()"); + setAppImportable(importableName); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("__call__ counter = 0", result); + } + + public void testAppImportInstantiableCached ( ) + throws Exception + { + appInvocationTestSetUp(); + setInitParameter("cache_callables", "1"); + String importableName = setupAppImport("WSGIHandlerClass()"); + setAppImportable(importableName); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("__call__ counter = 0", result); + clearOutput(); + doGet(); + result = getOutput(); + assertEquals("__call__ counter = 1", result); + } + + public void testAppImportInstantiableNotCached ( ) + throws Exception + { + appInvocationTestSetUp(); + setInitParameter("cache_callables", "0"); + String importableName = setupAppImport("WSGIHandlerClass()"); + setAppImportable(importableName); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("__call__ counter = 0", result); + clearOutput(); + doGet(); + result = getOutput(); + assertEquals("__call__ counter = 0", result); + } + + public void testAppImportInstantiableMethod ( ) + throws Exception + { + appInvocationTestSetUp(); + String importableName = setupAppImport("WSGIHandlerClass().handler_fn"); + setAppImportable(importableName); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("handler_fn counter = 0", result); + } + + public void testAppImportInstantiableBadMethod ( ) + throws Exception + { + appInvocationTestSetUp(); + String importableName = setupAppImport("WSGIHandlerClass().handler_fn.fn_attr"); + setAppImportable(importableName); + createServlet(); + doGet(); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + } + + public void testAppImportInstantiableMethodCached ( ) + throws Exception + { + appInvocationTestSetUp(); + setInitParameter("cache_callables", "1"); + String importableName = setupAppImport("WSGIHandlerClass().handler_fn"); + setAppImportable(importableName); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("handler_fn counter = 0", result); + clearOutput(); + doGet(); + result = getOutput(); + assertEquals("handler_fn counter = 1", result); + } + + public void testAppImportInstantiableMethodNotCached ( ) + throws Exception + { + appInvocationTestSetUp(); + setInitParameter("cache_callables", "0"); + String importableName = setupAppImport("WSGIHandlerClass().handler_fn"); + setAppImportable(importableName); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("handler_fn counter = 0", result); + clearOutput(); + doGet(); + result = getOutput(); + assertEquals("handler_fn counter = 0", result); + } + + public void testBadAppImport() + throws Exception + { + appInvocationTestSetUp(); + setAppImportable("never.existed"); + createServlet(); + doGet(); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + } + +} Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestBase.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestBase.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestBase.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,287 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +import java.io.File; + +import java.util.Map; +import java.util.Iterator; + +import junit.framework.*; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServlet; + +import com.mockrunner.servlet.BasicServletTestCaseAdapter; +import com.mockrunner.mock.web.WebMockObjectFactory; +import com.mockrunner.mock.web.MockServletConfig; +import com.mockrunner.mock.web.MockServletContext; +import com.mockrunner.mock.web.MockHttpServletRequest; +import com.mockrunner.mock.web.MockHttpServletResponse; + +import org.jdom.Element; +import org.jdom.output.XMLOutputter; + +import org.python.core.PyObject; +import org.python.util.PythonInterpreter; + +import com.xhaus.modjy.ModjyJServlet; + +/** + * + */ + +public class ModjyTestBase extends BasicServletTestCaseAdapter +{ + + final static String DEFAULT_APP_DIR = "test_apps_dir"; + final static String LIB_PYTHON_DIR = "lib-python"; + final static String LIB_PYTHON_TEST_PATH = "lib_python_folder"; + final static String DEFAULT_APP_FILE = "simple_app.py"; + final static String DEFAULT_APP_NAME = "simple_app"; + + public WebMockObjectFactory factory; + public MockServletConfig servletConfig; + public MockServletContext servletContext; + + public WebMockObjectFactory getFactory () + { + if (factory == null) + factory = getWebMockObjectFactory(); + return factory; + } + + public MockServletConfig getConfig () + { + if (servletConfig == null) + servletConfig = getFactory().getMockServletConfig(); + return servletConfig; + } + + public MockServletContext getContext () + { + if (servletContext == null) + servletContext = getFactory().getMockServletContext(); + return servletContext; + } + +// public void dumpContextRealPaths ( ) +// { +// Map pathMap = ((LoggingMockServletContext)getContext()).actualPaths; +// Iterator it = pathMap.keySet().iterator(); +// while (it.hasNext()) +// { +// String pathName = (String) it.next(); +// System.out.println("Path '"+pathName+"'-->'"+pathMap.get(pathName)+"'"); +// } +// } + + public void setInitParameter ( String name, String value ) + { + getConfig().setInitParameter(name, value); + } + + public void setRealPath ( String source, String target ) + { + getContext().setRealPath(source, target); + } + + public void addHeader(String headerName, String headerValue) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.addHeader(headerName, headerValue); + getFactory().addRequestWrapper(request); + } + + public void setBodyContent(String content) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setBodyContent(content); + getFactory().addRequestWrapper(request); + } + + public void setServletContextPath(String path) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setContextPath(path); + getFactory().addRequestWrapper(request); + } + + public void setServletPath(String path) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setServletPath(path); + getFactory().addRequestWrapper(request); + } + + public void setRequestURI(String uri) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setRequestURI(uri); + getFactory().addRequestWrapper(request); + } + + public void setScheme(String scheme) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setScheme(scheme); + getFactory().addRequestWrapper(request); + } + + public void setPathInfo(String pathInfo) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setPathInfo(pathInfo); + getFactory().addRequestWrapper(request); + } + + public void setQueryString(String qString) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setQueryString(qString); + getFactory().addRequestWrapper(request); + } + + public void setProtocol(String protocol) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setProtocol(protocol); + getFactory().addRequestWrapper(request); + } + + public void setServerName(String name) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + // Using setLocalName() here: See here for more: http://docs.sun.com/source/819-0077/J2EE.html + request.setLocalName(name); + getFactory().addRequestWrapper(request); + } + + public void setServerPort(int port) + { + MockHttpServletRequest request = (MockHttpServletRequest) getFactory().getWrappedRequest(); + request.setLocalPort(port); + getFactory().addRequestWrapper(request); + } + + public void setPythonHome(String app_dir) + { + setInitParameter("python.home", app_dir); + } + + public void setAppDir(String app_dir) + { + setInitParameter("app_directory", app_dir); + } + + public void setAppFile(String app_file) + { + setInitParameter("app_filename", app_file); + } + + public void setAppName(String app_name) + { + setInitParameter("app_callable_name", app_name); + } + + public void setAppImportable(String app_path) + { + setAppDir(""); + setAppFile(""); + setAppName(""); + setInitParameter("app_import_name", app_path); + } + + public MockHttpServletResponse getResponse() + { + MockHttpServletResponse response = (MockHttpServletResponse) getFactory().getWrappedResponse(); + return response; + } + + public int getStatus() + { + MockHttpServletResponse response = (MockHttpServletResponse) getFactory().getWrappedResponse(); + return response.getStatusCode(); + } + + protected void baseSetUp() + throws Exception + { + super.setUp(); + String jythonHome = System.getenv("JYTHON_HOME"); + setRealPath(jythonHome, jythonHome); + setRealPath("/WEB-INF/"+LIB_PYTHON_DIR, LIB_PYTHON_TEST_PATH); + setRealPath("/WEB-INF/lib/modjy.jar", "../modjy.jar"); + setPythonHome(jythonHome); + setAppDir(DEFAULT_APP_DIR); + setAppFile(DEFAULT_APP_FILE); + setAppName(DEFAULT_APP_NAME); + setInitParameter("exc_handler", "testing"); +// dumpContextRealPaths(); + } + + protected PyObject evalPythonString(String pyString) + { + // Efficiency be damned: it's a testing phase + PythonInterpreter interp = new PythonInterpreter(); + try + { + return interp.eval(pyString); + } + catch (Exception x) + { + System.err.println("Exception evaling '"+pyString+"': " + x); + return null; + } + } + + protected void createServlet() + { + createServlet(ModjyJServlet.class); + // Set zero content: this can be overridden later + setBodyContent(""); + clearOutput(); + } + + // Leave this here as a simple template for a test + public void testHelloWorld() throws Exception + { + baseSetUp(); + createServlet(); + doGet(); + String result = new XMLOutputter().outputString(getOutputAsJDOMDocument()); + } + + public static void main(String args[]) + { + TestSuite suite = new TestSuite(); + suite.addTestSuite(ModjyTestBase.class); + suite.addTestSuite(ModjyTestAppInvocation.class); + suite.addTestSuite(ModjyTestEnviron.class); + suite.addTestSuite(ModjyTestHeaders.class); + suite.addTestSuite(ModjyTestContentHeaders.class); + suite.addTestSuite(ModjyTestReturnIterable.class); + suite.addTestSuite(ModjyTestWebInf.class); + suite.addTestSuite(ModjyTestWSGIStreams.class); + junit.textui.TestRunner.run(suite); + } + +} Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestContentHeaders.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestContentHeaders.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestContentHeaders.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,81 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +import com.mockrunner.base.NestedApplicationException; +import org.python.core.PyException; + +public class ModjyTestContentHeaders extends ModjyTestBase +{ + + // From: http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1 + + protected void contentHeaderTestSetUp() + throws Exception + { + baseSetUp(); + setAppFile("content_header_tests.py"); + } + + public void doHeaderTest(String appName, String queryString) + throws Exception + { + contentHeaderTestSetUp(); + setAppName(appName); + createServlet(); + if (queryString != null) + setQueryString(queryString); + doGet(); + } + + public void doHeaderTest(String appName) + throws Exception + { + doHeaderTest(appName, null); + } + + public void testSetContentLengthHeader ( ) + throws Exception + { + doHeaderTest("test_set_content_length"); + assertEquals("Status code != 200: ServerError, =='"+getStatus()+"'", 200, getStatus()); + } + + public void testSetBadContentLengthHeader ( ) + throws Exception + { + doHeaderTest("test_set_bad_content_length"); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + assertTrue("Could not find exception 'BadArgument' in output", + getOutput().indexOf("BadArgument")!=-1); + } + + public void testInferredContentLength ( ) + throws Exception + { + String appReturn = "Hello World!"; + doHeaderTest("test_inferred_content_length", appReturn); + assertEquals("Status code != 200: ServerError, =='"+getStatus()+"'", 200, getStatus()); + assertEquals("Content-length != '"+appReturn.length()+"', == '"+getResponse().getHeader("content-length")+"' ", + Integer.toString(appReturn.length()), getResponse().getHeader("content-length")); + } + +} Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestEnviron.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestEnviron.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestEnviron.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,328 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +import org.python.core.PyDictionary; +import org.python.core.PyInteger; +import org.python.core.PyObject; +import org.python.core.PyString; +import org.python.core.PyTuple; + +public class ModjyTestEnviron extends ModjyTestBase +{ + + protected void environTestSetUp() + throws Exception + { + baseSetUp(); + setAppFile("environ_tests.py"); + } + + public void testEnvIsDict ( ) + throws Exception + { + // Spec says that the env MUST be a dict, not a subclass or emulation. + environTestSetUp(); + setAppName("test_env_is_dict"); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals(result, "true"); + } + + public void testEnvIsMutable ( ) + throws Exception + { + // Spec says that the env must be mutable. + environTestSetUp(); + setAppName("test_env_is_mutable"); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals(result, "true"); + } + + public void doRequestMethodTest ( String method ) + throws Exception + { + // Check that the environment contains the REQUEST_METHOD var + // REQUEST_METHOD + environTestSetUp(); + setAppName("test_env_contains_request_method"); + createServlet(); + method = method.toLowerCase(); + // Java needs first class functions + if (method == "delete") doDelete(); + else if (method == "get") doGet(); + else if (method == "head") doHead(); + else if (method == "options") doOptions(); + else if (method == "post") doPost(); + else if (method == "put") doPut(); + else if (method == "trace") doTrace(); + String result = getOutput(); + assertEquals(result, method.toUpperCase()); + } + + public void testRequestMethod() + throws Exception + { + doRequestMethodTest("delete"); + doRequestMethodTest("get"); + doRequestMethodTest("head"); + doRequestMethodTest("options"); + doRequestMethodTest("post"); + doRequestMethodTest("put"); + doRequestMethodTest("trace"); + } + + // This test doesn't really achieve much, because mockrunner doesn't actually do any computation + // on the incoming URI: you have to set the servletContextPath(SCRIPT_NAME) and PathInfo(PATH_INFO) + // yourself. + // Still, best to include the test. + // Maybe in the future we can implement a subclass of MockHttpServletRequest + // which actually does computation on the incoming URI to work out the pathInfo. + + public void doScriptNamePathInfoTest ( String contextPath, String servletPath, String URI, String pathInfo, + String expectedScriptName, String expectedPathInfo, boolean appImportable ) + throws Exception + { + environTestSetUp(); + if (appImportable) + setAppImportable("script_name_path_info.test_env_script_name_path_info"); + else + setAppName("test_env_script_name_path_info"); + createServlet(); + setServletContextPath(contextPath); + setServletPath(servletPath); + setRequestURI(URI); + setPathInfo(pathInfo); + doGet(); + String output = getOutput(); + String[] results = output.split(":::"); + assertEquals("ScriptName '"+results[0]+"' != '"+expectedScriptName+"'", expectedScriptName, results[0]); + String actualPathInfo = ""; + if (results.length > 1) + actualPathInfo = results[1]; + assertEquals("PathInfo '"+actualPathInfo+"' != '"+expectedPathInfo+"'", actualPathInfo, expectedPathInfo); + } + + public void testScriptNamePathInfo ( ) + throws Exception + { + // Check that the environment contains correct values for SCRIPT_NAME and PATH_INFO + String[][] testData = new String[][] { + {"", "/", "" }, + {"", "/", "info" }, + {"/ctx", "/srv", "" }, + {"/ctx", "/srv", "/info" }, + {"/ctx", "/srv/sub", "" }, + {"/ctx", "/srv/sub", "/info" }, + }; + for (int ix = 0 ; ix < testData.length ; ix++) + { + String contextPath = testData[ix][0]; + String servletPath = testData[ix][1]; + String pathInfo = testData[ix][2]; + String uri = contextPath+servletPath+pathInfo; + String expectedScriptName = contextPath+servletPath; + String expectedPathInfo = pathInfo; + doScriptNamePathInfoTest(contextPath, servletPath, uri, pathInfo, contextPath+servletPath, expectedPathInfo, false); + doScriptNamePathInfoTest(contextPath, servletPath, uri, pathInfo, contextPath+servletPath, expectedPathInfo, true); + } + } + + // Again, this test doesn't achieve a lot under mockrunner, because you have to + // set the query string yourself. + + public void doQueryStringTest ( String actualQString, String expectedQString) + throws Exception + { + environTestSetUp(); + setAppName("test_env_query_string"); + createServlet(); + setQueryString(actualQString); + doGet(); + String result = getOutput(); + assertEquals("QueryString '"+result+"' != '"+expectedQString+"'", result, expectedQString); + } + + public void testQueryString() + throws Exception + { + // Test no query string + doQueryStringTest(null, ""); + // Test empty query string + doQueryStringTest("", ""); + // Test variable no value + doQueryStringTest("name", "name"); + // Test variable and value + doQueryStringTest("name=value", "name=value"); + // Test two name/value pairs + doQueryStringTest("n1=v1&n2=v2", "n1=v1&n2=v2"); + // Test no unquoting done + doQueryStringTest("var=hello+world!", "var=hello+world!"); + // Any illegal values to test? + } + + public void testContentVars ( ) + { + // Test CONTENT_TYPE and CONTENT_LENGTH + // Perhaps these should be done with the WSGIInput tests? + } + + public PyObject doEnvVarTest(String name) + throws Exception + { + environTestSetUp(); + setAppName("test_echo_wsgi_env"); + createServlet(); + setQueryString(name); + doGet(); + String output = getOutput(); + PyDictionary result = (PyDictionary) evalPythonString(output); + return result.__finditem__(name); + } + + public void doEnvVarTestCheckReturn(String name, String value) + throws Exception + { + PyString envVar = (PyString) doEnvVarTest(name); + assertTrue("Env var '"+name+"' != '"+value+"', == '"+envVar.toString()+"'", + envVar.toString().compareTo(value)==0); + } + + public void testServerParams_ServerName() + throws Exception + { + String serverName = "ModjyServerTest"; + setServerName(serverName); + doEnvVarTestCheckReturn("SERVER_NAME", serverName); + } + + public void testServerParams_ServerPort() + throws Exception + { + int serverPort = 54321; + setServerPort(serverPort); + doEnvVarTestCheckReturn("SERVER_PORT", String.valueOf(serverPort)); + } + + public void testServerParams_ServerProtocol() + throws Exception + { + String serverProtocol = "HTTP/1.1"; + setProtocol(serverProtocol); + doEnvVarTestCheckReturn("SERVER_PROTOCOL", serverProtocol); + } + + public void testOtherHttpVars ( ) + { + // Test other vars that begin with HTTP + } + + public void testMandatoryWSGIVars_WSGIVersion ( ) + throws Exception + { + PyObject result = doEnvVarTest("wsgi.version"); + assertTrue("'wsgi.version' != PyTuple", result instanceof org.python.core.PyTuple); + assertEquals("'wsgi.version[0]' != '1'", ((PyInteger)result.__getitem__(0)).getValue(), 1); + assertEquals("'wsgi.version[1]' != '0'", ((PyInteger)result.__getitem__(1)).getValue(), 0); + } + + public void testMandatoryWSGIVars_URLScheme_HTTP ( ) + throws Exception + { + String scheme = "http"; + setScheme(scheme); + doEnvVarTestCheckReturn("wsgi.url_scheme", scheme); + } + + public void testMandatoryWSGIVars_URLScheme_HTTPS ( ) + throws Exception + { + String scheme = "https"; + setScheme(scheme); + doEnvVarTestCheckReturn("wsgi.url_scheme", scheme); + } + + public void testMandatoryWSGIVars_Other ( ) + throws Exception + { + // These should be checked under input and error handling respectively + //wsgi.input + //wsgi.errors + // These should be checked under app invocation + //wsgi.multithread + //wsgi.multiprocess + //wsgi.run_once + } + + public void testEnvContainsModjySpecificVars ( ) + { + // Test that the environment contains all of the modjy specific vars + } + + public void testUserSpecifiedEnv ( ) + throws Exception + { + // Set a user specified environment in the servlet config, then test that it is passed through. + String envName1 = "ENVVAR1"; + String envValue1 = "ENVVAL1"; + String envName2 = "ENVVAR2"; + String envValue2 = "ENVVAL2"; + String initialEnv = "\n"+envName1+"\t: "+envValue1+"\n"+envName2+" :\t"+envValue2+"\n"; + setInitParameter("initial_env", initialEnv); + doEnvVarTestCheckReturn(envName1, envValue1); + doEnvVarTestCheckReturn(envName2, envValue2); + } + + public void testUserConfigVars ( ) + { + // Set some environment vars in the servlet config, then test that they are passed through. + } + + public void testCgiVarsAreStr ( ) + throws Exception + { + // PEP-333 states that all CGI vars must be str, not unicode + // http://www.python.org/dev/peps/pep-0333/#unicode-issues + environTestSetUp(); + setAppName("test_cgi_vars_are_str"); + createServlet(); + doGet(); + String output = getOutput(); + assertEquals("pass", output); + } + + public void testMultipleHeaderValues ( ) + throws Exception + { + environTestSetUp(); + setAppName("test_multiple_header_values"); + createServlet(); + addHeader("MULTIPLE", "value 1"); + addHeader("MULTIPLE", "value 2"); + doGet(); + String output = getOutput(); + assertEquals("pass", output); + } + +} Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestHeaders.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestHeaders.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestHeaders.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,200 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +import com.mockrunner.base.NestedApplicationException; +import org.python.core.PyException; + +public class ModjyTestHeaders extends ModjyTestBase +{ + + // From: http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.1 + + final static String[] hop_by_hop_headers = new String[] { + "connection", + "keep-alive", + "proxy-authenticate", + "proxy-authorization", + "te", + "trailers", + "transfer-encoding", + "upgrade", + }; + + protected void headerTestSetUp() + throws Exception + { + baseSetUp(); + setAppFile("header_tests.py"); + } + + public void doHeaderTest(String appName, String queryString) + throws Exception + { + headerTestSetUp(); + setAppName(appName); + createServlet(); + if (queryString != null) + setQueryString(queryString); + doGet(); + } + + public void doHeaderTest(String appName) + throws Exception + { + doHeaderTest(appName, null); + } + + public void testInvalidStatusCode() + throws Exception + { + doHeaderTest("test_invalid_status_code"); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + assertTrue("Could not find exception 'BadArgument' in output: " + getOutput(), + getOutput().indexOf("BadArgument")!=-1); + } + + public void testNonLatin1StatusString() + throws Exception + { + // We'll let this one pass: + // 1. The integer status code can't be anything but an ASCII-encoded integer + // 2. The reason phrase is discarded on J2EE anyway + // Modjy takes no action if a non latin-1 status string is passed + doHeaderTest("test_non_latin1_status_string"); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + assertTrue("Could not find exception 'BadArgument' in output: " + getOutput(), + getOutput().indexOf("BadArgument")!=-1); + } + + public void testLatin1StatusStringWithControlChars() + throws Exception + { + // We'll let this one pass: + // 1. The integer status code can't be anything but an ASCII-encoded integer + // 2. The reason phrase is discarded on J2EE anyway + // Modjy takes no action if a status string with control chars is passed + doHeaderTest("test_control_chars_in_status_string"); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + assertTrue("Could not find exception 'BadArgument' in output: " + getOutput(), + getOutput().indexOf("BadArgument")!=-1); + } + + public void doBadHeadersListTest(String appName) + throws Exception + { + for (int i = 1 ; i < 5 ; i++) + { + doHeaderTest(appName, String.valueOf(i)); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + String firstLine = getOutput().split("\n")[0]; + assertTrue("Could not find exception 'BadArgument' in output: " + firstLine, + firstLine.indexOf("BadArgument")!=-1); + } + } + + public void testHeadersNotList ( ) + throws Exception + { + // Ensure that setting headers to anything other than a list raises an error + doBadHeadersListTest("test_headers_not_list"); + } + + public void testHeadersListContainsNonTuples ( ) + throws Exception + { + // Ensure that setting headers to anything other than a list raises an error + doBadHeadersListTest("test_headers_list_non_tuples"); + } + + public void testHeadersListContainsWrongLengthTuples ( ) + throws Exception + { + // Ensure that setting headers to anything other than a list of 2-tuples raises an error + doBadHeadersListTest("test_headers_list_wrong_length_tuples"); + } + + public void testHeadersListContainsWrongTypeTuples ( ) + throws Exception + { + // Ensure that setting headers to anything other than a list of 2-tuples of strings raises an error + doBadHeadersListTest("test_headers_list_wrong_types_in_tuples"); + } + + public void testHeadersListContainsNonLatin1Values ( ) + throws Exception + { + // Ensure that setting header values to non-latin1 strings raises an error + doBadHeadersListTest("test_headers_list_contains_non_latin1_values"); + } + + public void testHeadersListContainsValuesWithControlChars ( ) + throws Exception + { + // Ensure that setting header values to strings raises an error + // Disable this test: Modjy doesn't test for control characters. + // doBadHeadersListTest("test_headers_list_contains_values_with_control_chars"); + } + + public void testHeadersListContainsAccentedLatin1Values ( ) + throws Exception + { + // Ensure that setting header values to 8-bit latin1 strings works properly + String headerName = "x-latin1-header"; + String headerValue = "\u00e1\u00e9\u00ed\u00f3\u00fa"; + String headerQString = headerName + "=" + headerValue; + doHeaderTest("test_headers_list_contains_accented_latin1_values", headerQString); + assertEquals("Status code != 200: ServerError, =='"+getStatus()+"'", 200, getStatus()); + assertTrue("Header '"+headerName+"' not returned: ", getResponse().containsHeader(headerName)); + assertEquals("Header '"+headerName+"' != '"+headerValue+"', == '"+getResponse().getHeader(headerName)+"' ", + headerValue, getResponse().getHeader(headerName)); + } + + public void testHopByHopHeaders ( ) + throws Exception + { + // Test that attempts to set hop-by-hop headers raise exception. + for (int i = 0 ; i < hop_by_hop_headers.length ; i++) + { + doHeaderTest("test_hop_by_hop", hop_by_hop_headers[i]); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + assertTrue("Could not find exception 'HopByHopHeaderSet' in output", + getOutput().indexOf("HopByHopHeaderSet")!=-1); + } + } + + public void testSetHeader ( ) + throws Exception + { + // test that we can set headers + } + + public void testMultilineHeaders () + { + // Need to do some research on this + } + + public void testRFC2047EncodedHeaders ( ) + { + // Need to do some research on this + } + +} Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestReturnIterable.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestReturnIterable.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestReturnIterable.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,184 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +public class ModjyTestReturnIterable extends ModjyTestBase +{ + + protected void returnTestSetUp() + throws Exception + { + baseSetUp(); + setAppFile("return_tests.py"); + } + + public void doReturnTest(String appName, String queryString) + throws Exception + { + returnTestSetUp(); + setAppName(appName); + createServlet(); + if (queryString != null) + setQueryString(queryString); + doGet(); + } + + public void doReturnTest(String appName) + throws Exception + { + doReturnTest(appName, null); + } + + public void doWrongReturnTypeTest(String appName, String typeString) + throws Exception + { + // Try to return not-iterables + doReturnTest(appName, typeString); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + String firstLine = getOutput().split("\n")[0]; + assertTrue("Could not find exception 'ReturnNotIterable' in output: " + firstLine, + firstLine.indexOf("ReturnNotIterable")!=-1); + + } + + public void testReturnString ( ) + throws Exception + { + doWrongReturnTypeTest("test_non_iterable_return", "str"); + } + + public void testReturnUnicode ( ) + throws Exception + { + doWrongReturnTypeTest("test_non_iterable_return", "unicode"); + } + + public void testReturnInt ( ) + throws Exception + { + doWrongReturnTypeTest("test_non_iterable_return", "int"); + } + + public void testReturnFloat ( ) + throws Exception + { + doWrongReturnTypeTest("test_non_iterable_return", "float"); + } + + public void testReturnNone ( ) + throws Exception + { + doWrongReturnTypeTest("test_non_iterable_return", "none"); + } + + public void doIterableContainsWrongReturnTypeTest(String appName, String typeString) + throws Exception + { + // Try to return not-iterables + doReturnTest(appName, typeString); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + String firstLine = getOutput().split("\n")[0]; + assertTrue("Could not find exception 'NonStringOutput' in output: " + firstLine, + firstLine.indexOf("NonStringOutput")!=-1); + } + + public void testReturnIterableContainingInt ( ) + throws Exception + { + doIterableContainsWrongReturnTypeTest("test_iterable_containing_non_strings_return", "int"); + } + + public void testReturnIterableContainingFloat ( ) + throws Exception + { + doIterableContainsWrongReturnTypeTest("test_iterable_containing_non_strings_return", "float"); + } + + public void testReturnIterableContainingNone ( ) + throws Exception + { + doIterableContainsWrongReturnTypeTest("test_iterable_containing_non_strings_return", "none"); + } + + public void testStartResponseNotCalled ( ) + throws Exception + { + doReturnTest("test_start_response_not_called"); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + String firstLine = getOutput().split("\n")[0]; + assertTrue("Could not find exception 'StartResponseNotCalled' in output: " + firstLine, + firstLine.indexOf("StartResponseNotCalled")!=-1); + } + + public void testBadLengthIterator ( ) + throws Exception + { + doReturnTest("test_bad_length_iterator"); + assertEquals("Status code != 500: ServerError, =='"+getStatus()+"'", 500, getStatus()); + assertTrue("Could not find exception 'WrongLength' in output", + getOutput().indexOf("WrongLength")!=-1); + } + + String testData = "Drifting breeze-blown clouds:\r\n"+ + "Shadows glide across the grass..\r\n"+ + "Apple blossom falls.\r\n"; + + public void doCorrectIterableTest(String appName) + throws Exception + { + // Try to return not-iterables + doReturnTest(appName, testData); + assertEquals("Status code != 200: ServerError, =='"+getStatus()+"'", 200, getStatus()); + String output = getOutput(); + assertEquals(output, testData); + } + + public void testReturnListOfString() + throws Exception + { + doCorrectIterableTest("test_return_list_strings"); + } + + public void testReturnGenerator() + throws Exception + { + doCorrectIterableTest("test_return_generator"); + } + + public void testReturnFileLike() + throws Exception + { + doCorrectIterableTest("test_return_file_like"); + } + + public void testLineEndsNotTranslated ( ) + throws Exception + { + doCorrectIterableTest("test_return_list_strings"); + } + + public void testIterableInstance ( ) + throws Exception + { + doCorrectIterableTest("test_iterable_instance"); + } + +} Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWSGIStreams.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWSGIStreams.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWSGIStreams.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,142 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +import org.python.core.PyDictionary; +import org.python.core.PyString; + +public class ModjyTestWSGIStreams extends ModjyTestBase + { + + protected void streamTestSetUp() + throws Exception + { + baseSetUp(); + setAppFile("stream_tests.py"); + } + + // Tests in here are really container independent: no guarantee + // that mockrunner correctly simulates container behaviour + + public void doInputTest ( String appName, String bodyContent, String expectedContent, int expectedLength, int readSize ) + throws Exception + { + streamTestSetUp(); + setAppName(appName); + createServlet(); + // createServlet sets a default content string of "", so must override after, not before + setBodyContent(bodyContent); + // If there is a read length, set it in the query string + if (readSize != 0) + setQueryString("readsize="+String.valueOf(readSize)); + doGet(); + String app_output = getOutput(); + PyDictionary result = (PyDictionary) evalPythonString(app_output); + String instream_contents = ((PyString)result.__finditem__("data")).toString(); + assertEquals("Application output length != "+expectedLength+", =='"+instream_contents.length()+"'", + instream_contents.length(), expectedLength); + assertEquals("Application output != '"+expectedContent+"', =='"+instream_contents+"'", + instream_contents, expectedContent); + } + + public void doInputTest ( String appName, String bodyContent, String expectedContent, int expectedLength ) + throws Exception + { + doInputTest(appName, bodyContent, expectedContent, expectedLength, 0); + } + + public void testEmptyInput ( ) + throws Exception + { + doInputTest("test_read_input_stream", "", "", 0); + } + + public void testEmptyInputWithReadSize ( ) + throws Exception + { + doInputTest("test_read_input_stream", "", "", 0, 1024); + } + + public void testAsciiInput ( ) + throws Exception + { + doInputTest("test_read_input_stream", "Hello World!", "Hello World!", 12); + } + + public void testAsciiInputWithReadSize ( ) + throws Exception + { + for (int i = 0 ; i < 14 ; i++) + doInputTest("test_read_input_stream", "Hello World!", "Hello World!", 12, i); + } + + public void testAsciiInputReadline ( ) + throws Exception + { + doInputTest("test_readline_input_stream", "Hello\nWorld!\n", "Hello\n", 6); + doInputTest("test_readline_input_stream", "Hello", "Hello", 5); + } + + public void testAsciiInputReadlineWithSize ( ) + throws Exception + { + // Let's test this: although PEP-333 says it's not supported, modjy can do it + doInputTest("test_readline_input_stream", "Hello\nWorld!\n", "Hello", 5, 5); + } + + public void testAsciiInputWithReadlines ( ) + throws Exception + { + doInputTest("test_readlines_input_stream", "Hello\nWorld!\n", "Hello\n$World!\n", 14); + doInputTest("test_readlines_input_stream", "Hello", "Hello", 5); + } + + public void testAsciiInputWithReadlinesWithHint ( ) + throws Exception + { + // Let's leave this for now + // doInputTest("test_readlines_input_stream", "Hello\nWorld!\n", "Hello\n", 6, 5); + } + + public void testError () + throws Exception + { + // For now, just check the requisite methods exist and are callable + streamTestSetUp(); + setAppName("test_error_stream"); + createServlet(); + doGet(); + String app_output = getOutput(); + assertEquals("Application output != 'success', =='"+app_output+"'", + "success", app_output); + } + + public void testContentType() + { + // This probably needs several tests + } + + public void testContentLength() + { + // This probably needs several tests + } + + } Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWebInf.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWebInf.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWebInf.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,84 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +import java.io.File; + +import org.python.core.PyDictionary; +import org.python.core.PyInteger; +import org.python.core.PyObject; +import org.python.core.PyString; +import org.python.core.PyTuple; + +public class ModjyTestWebInf extends ModjyTestBase +{ + + final static String callables_dir = "test_apps"; + + protected void webInfTestSetUp() + throws Exception + { + baseSetUp(); + setAppFile("web_inf_tests.py"); + setRealPath("/WEB-INF/lib-python/some_libs", "lib_python_folder/test-lib"); + setRealPath("/WEB-INF/lib-python/some_libs/__init__.py", "lib_python_folder/test_lib/__init__.py"); + setRealPath("/WEB-INF/lib-python/some_libs/some_libs.py", "lib_python_folder/test_lib/some_libs.py"); + } + + public void testLibPythonVisible ( ) + throws Exception + { + // Check that a lib directory in lib-python is visible. + webInfTestSetUp(); + setAppName("test_import_from_lib_python"); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("Factorial 10 is 3628800", result); + } + + public void testImportFromZipInLibPython ( ) + throws Exception + { + // Check that a lib directory in lib-python is visible. + webInfTestSetUp(); + setRealPath("/WEB-INF/lib-python/test_modules.zip", "lib_python_folder/test_modules.zip"); + setRealPath("/WEB-INF/lib-python/add_zips.pth", "lib_python_folder/add_zips.pth"); + setAppName("test_import_from_zip_file"); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("This is a library function", result); + } + + public void testImportInPthFile ( ) + throws Exception + { + webInfTestSetUp(); + setRealPath("/WEB-INF/lib-python/do_import.pth", "lib_python_folder/do_import.pth"); + setAppName("test_execed_import_in_pth"); + createServlet(); + doGet(); + String result = getOutput(); + assertEquals("pass", result); + } + +} Added: branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWriteCallable.java =================================================================== --- branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWriteCallable.java (rev 0) +++ branches/modjy/tests/modjy/java/com/xhaus/modjy/ModjyTestWriteCallable.java 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,32 @@ +/*### +# +# Copyright Alan Kennedy. +# +# You may contact the copyright holder at this uri: +# +# http://www.xhaus.com/contact/modjy +# +# The licence under which this code is released is the Apache License v2.0. +# +# The terms and conditions of this license are listed in a file contained +# in the distribution that also contained this file, under the name +# LICENSE.txt. +# +# You may also read a copy of the license at the following web address. +# +# http://modjy.xhaus.com/LICENSE.txt +# +###*/ + +package com.xhaus.modjy; + +class ModjyTestWriteCallable extends ModjyTestBase + { + + public void testLineEndsNotTranslated ( ) + { + // Spec says no translation on output + } + + + } Added: branches/modjy/tests/modjy/lib_python_folder/add_zips.pth =================================================================== --- branches/modjy/tests/modjy/lib_python_folder/add_zips.pth (rev 0) +++ branches/modjy/tests/modjy/lib_python_folder/add_zips.pth 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1 @@ +test_modules.zip Added: branches/modjy/tests/modjy/lib_python_folder/do_import.pth =================================================================== --- branches/modjy/tests/modjy/lib_python_folder/do_import.pth (rev 0) +++ branches/modjy/tests/modjy/lib_python_folder/do_import.pth 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,4 @@ +# This is to test whether an import statement in a pth file is correctly exec'ed +# http://www.python.org/doc/2.5/lib/module-site.html + +import math Added: branches/modjy/tests/modjy/lib_python_folder/mock_framework/web/handlers/wsgi_handlers.py =================================================================== --- branches/modjy/tests/modjy/lib_python_folder/mock_framework/web/handlers/wsgi_handlers.py (rev 0) +++ branches/modjy/tests/modjy/lib_python_folder/mock_framework/web/handlers/wsgi_handlers.py 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,22 @@ +# -*- coding: windows-1252 -*- + +class WSGIHandlerClass: + + def __init__(self): + self.counter = 0 + + def _response(self, start_response_callable, called): + start_response_callable("200 OK", []) + result = "%s counter = %d" % (called, self.counter) + self.counter += 1 + return [result] + + def __call__(self, environ, start_response_callable): + return self._response(start_response_callable, "__call__") + + def handler_fn(self, environ, start_response_callable): + return self._response(start_response_callable, "handler_fn") + +def WSGIHandlerFunction(environ, start_response_callable): + start_response_callable("200 OK", []) + return ['WSGIHandlerFunction called.'] Added: branches/modjy/tests/modjy/lib_python_folder/script_name_path_info.py =================================================================== --- branches/modjy/tests/modjy/lib_python_folder/script_name_path_info.py (rev 0) +++ branches/modjy/tests/modjy/lib_python_folder/script_name_path_info.py 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,6 @@ +# -*- coding: windows-1252 -*- + +def test_env_script_name_path_info(environ, start_response): + writer = start_response("200 OK", []) + writer("%s:::%s" % (environ['SCRIPT_NAME'], environ['PATH_INFO'])) + return [] Added: branches/modjy/tests/modjy/lib_python_folder/test_lib/__init__.py =================================================================== --- branches/modjy/tests/modjy/lib_python_folder/test_lib/__init__.py (rev 0) +++ branches/modjy/tests/modjy/lib_python_folder/test_lib/__init__.py 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,10 @@ +# -*- coding: windows-1252 -*- + +# Specify only the some_libs module. + +#__all__ = ['some_libs', ] + +# And define a simple function in here as well. + +def stringTransform(s): + return s.upper() Added: branches/modjy/tests/modjy/lib_python_folder/test_lib/some_libs.py =================================================================== --- branches/modjy/tests/modjy/lib_python_folder/test_lib/some_libs.py (rev 0) +++ branches/modjy/tests/modjy/lib_python_folder/test_lib/some_libs.py 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,5 @@ +# -*- coding: windows-1252 -*- + +def factorial(n): + if n == 1: return 1 + return n * factorial(n-1) Added: branches/modjy/tests/modjy/lib_python_folder/test_modules.zip =================================================================== (Binary files differ) Property changes on: branches/modjy/tests/modjy/lib_python_folder/test_modules.zip ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/modjy/tests/modjy/lines.txt =================================================================== --- branches/modjy/tests/modjy/lines.txt (rev 0) +++ branches/modjy/tests/modjy/lines.txt 2009-03-05 22:07:35 UTC (rev 6070) @@ -0,0 +1,4 @@ +This is line 1 +This is line 2 +This is line 3 + Added: branches/modjy/tests/modjy/readme.txt =================================================================== --- branches/modjy/tests/modjy/readme.txt (rev 0) +++ branches/modjy/tests/modjy/readme.txt 2009-03-05 22:... [truncated message content] |