From: Finn B. <bc...@us...> - 2001-03-13 20:23:48
|
Update of /cvsroot/jython/jython/org/python/util In directory usw-pr-cvs1:/tmp/cvs-serv28340 Modified Files: PyServlet.java Log Message: Use the new sys.add_ methods instead of playing with registry options. Fixed an inconsistency with tomcat-3.1 where the rootpath already ended with a path seperator. Use Properties.put to ensure complication on jdk1.1 Index: PyServlet.java =================================================================== RCS file: /cvsroot/jython/jython/org/python/util/PyServlet.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -r1.7 -r1.8 *** PyServlet.java 2001/02/16 18:13:45 1.7 --- PyServlet.java 2001/03/13 20:25:46 1.8 *************** *** 68,71 **** --- 68,73 ---- public void init() { rootPath = getServletContext().getRealPath("/"); + if (!rootPath.endsWith(File.separator)) + rootPath += File.separator; Properties props = new Properties(); *************** *** 73,100 **** while (e.hasMoreElements()) { String name = (String) e.nextElement(); ! props.setProperty(name, getInitParameter(name)); } if (props.getProperty("python.home") == null && System.getProperty("python.home") == null) { ! props.setProperty("python.home", rootPath + File.separator + ! "WEB-INF" + File.separator + ! "lib"); } - props.setProperty("python.packages.directories", - "java.ext.dirs,pyservlet.lib"); - props.setProperty("pyservlet.lib", - rootPath + File.separator + - "WEB-INF" + File.separator + - "lib"); - - props.setProperty("python.packages.paths", - "java.class.path,sun.boot.class.path,"+ - "pyservlet.classes"); - props.setProperty("pyservlet.classes", - rootPath + File.separator + - "WEB-INF" + File.separator + - "classes"); - PythonInterpreter.initialize(System.getProperties(), props, new String[0]); reset(); --- 75,86 ---- while (e.hasMoreElements()) { String name = (String) e.nextElement(); ! props.put(name, getInitParameter(name)); } if (props.getProperty("python.home") == null && System.getProperty("python.home") == null) { ! props.setProperty("python.home", rootPath + "WEB-INF" + ! File.separator + "lib"); } PythonInterpreter.initialize(System.getProperties(), props, new String[0]); reset(); *************** *** 105,108 **** --- 91,100 ---- sys.add_package("javax.servlet.jsp"); sys.add_package("javax.servlet.jsp.tagext"); + + sys.add_classdir(rootPath + "WEB-INF" + + File.separator + "classes"); + + sys.add_extdir(rootPath + "WEB-INF" + + File.separator + "lib"); } *************** *** 133,139 **** sys.path.append(new PyString(rootPath)); ! String modulesDir = rootPath + File.separator + ! "WEB-INF" + File.separator + ! "jython"; sys.path.append(new PyString(modulesDir)); } --- 125,130 ---- sys.path.append(new PyString(rootPath)); ! String modulesDir = rootPath + "WEB-INF" + ! File.separator + "jython"; sys.path.append(new PyString(modulesDir)); } *************** *** 195,199 **** destroyCache(); } - private void destroyCache() { --- 186,189 ---- |