You can subscribe to this list here.
| 2000 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(38) |
Nov
(98) |
Dec
(58) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2001 |
Jan
(114) |
Feb
(123) |
Mar
(96) |
Apr
(66) |
May
(84) |
Jun
(72) |
Jul
(128) |
Aug
(126) |
Sep
(82) |
Oct
(80) |
Nov
(148) |
Dec
(55) |
| 2002 |
Jan
(137) |
Feb
(85) |
Mar
(118) |
Apr
(67) |
May
(71) |
Jun
(28) |
Jul
(69) |
Aug
(48) |
Sep
(83) |
Oct
(79) |
Nov
(54) |
Dec
(32) |
| 2003 |
Jan
(44) |
Feb
(47) |
Mar
(59) |
Apr
(57) |
May
(43) |
Jun
(45) |
Jul
(44) |
Aug
(39) |
Sep
(27) |
Oct
(62) |
Nov
(17) |
Dec
(23) |
| 2004 |
Jan
(41) |
Feb
(51) |
Mar
(38) |
Apr
(30) |
May
(25) |
Jun
(12) |
Jul
(11) |
Aug
(27) |
Sep
(16) |
Oct
(56) |
Nov
(23) |
Dec
(29) |
| 2005 |
Jan
(75) |
Feb
(82) |
Mar
(50) |
Apr
(77) |
May
(19) |
Jun
(104) |
Jul
(47) |
Aug
(42) |
Sep
(28) |
Oct
(143) |
Nov
(62) |
Dec
(13) |
| 2006 |
Jan
(20) |
Feb
(10) |
Mar
(59) |
Apr
(45) |
May
(25) |
Jun
(129) |
Jul
(162) |
Aug
(91) |
Sep
(15) |
Oct
(39) |
Nov
(186) |
Dec
(191) |
| 2007 |
Jan
(134) |
Feb
(140) |
Mar
(106) |
Apr
(77) |
May
(92) |
Jun
(63) |
Jul
(233) |
Aug
(102) |
Sep
(119) |
Oct
(63) |
Nov
(68) |
Dec
(32) |
| 2008 |
Jan
(69) |
Feb
(91) |
Mar
(129) |
Apr
(44) |
May
(18) |
Jun
(53) |
Jul
(50) |
Aug
(25) |
Sep
(11) |
Oct
(28) |
Nov
(67) |
Dec
(36) |
| 2009 |
Jan
(20) |
Feb
(24) |
Mar
(66) |
Apr
(53) |
May
(48) |
Jun
(48) |
Jul
(59) |
Aug
(82) |
Sep
(49) |
Oct
(30) |
Nov
(16) |
Dec
(16) |
| 2010 |
Jan
(52) |
Feb
(25) |
Mar
(36) |
Apr
(34) |
May
(14) |
Jun
(15) |
Jul
(14) |
Aug
(16) |
Sep
(23) |
Oct
(6) |
Nov
(4) |
Dec
(5) |
| 2011 |
Jan
(4) |
Feb
(22) |
Mar
(45) |
Apr
(9) |
May
(8) |
Jun
(13) |
Jul
(12) |
Aug
(4) |
Sep
(6) |
Oct
(10) |
Nov
(21) |
Dec
(5) |
| 2012 |
Jan
(6) |
Feb
(9) |
Mar
(25) |
Apr
(6) |
May
(4) |
Jun
(23) |
Jul
(6) |
Aug
(18) |
Sep
(21) |
Oct
(34) |
Nov
(19) |
Dec
(25) |
| 2013 |
Jan
(8) |
Feb
(34) |
Mar
(35) |
Apr
(4) |
May
(11) |
Jun
(4) |
Jul
(7) |
Aug
(5) |
Sep
(20) |
Oct
(12) |
Nov
(11) |
Dec
(7) |
| 2014 |
Jan
(10) |
Feb
(18) |
Mar
(50) |
Apr
(26) |
May
(53) |
Jun
(21) |
Jul
(12) |
Aug
(39) |
Sep
(43) |
Oct
(26) |
Nov
(8) |
Dec
(6) |
| 2015 |
Jan
(18) |
Feb
(32) |
Mar
(31) |
Apr
(42) |
May
(38) |
Jun
(13) |
Jul
(6) |
Aug
(11) |
Sep
(29) |
Oct
(25) |
Nov
(10) |
Dec
(11) |
| 2016 |
Jan
(24) |
Feb
(12) |
Mar
(13) |
Apr
(15) |
May
(22) |
Jun
(8) |
Jul
(12) |
Aug
(25) |
Sep
(8) |
Oct
(6) |
Nov
(13) |
Dec
(7) |
| 2017 |
Jan
(6) |
Feb
(29) |
Mar
(32) |
Apr
(8) |
May
(82) |
Jun
(42) |
Jul
(20) |
Aug
(17) |
Sep
(27) |
Oct
(14) |
Nov
(22) |
Dec
(6) |
| 2018 |
Jan
(12) |
Feb
(9) |
Mar
(22) |
Apr
(19) |
May
(14) |
Jun
(9) |
Jul
(9) |
Aug
(22) |
Sep
(22) |
Oct
(12) |
Nov
(13) |
Dec
(8) |
| 2019 |
Jan
(22) |
Feb
(3) |
Mar
(30) |
Apr
(20) |
May
(20) |
Jun
(6) |
Jul
(15) |
Aug
(25) |
Sep
(11) |
Oct
(24) |
Nov
(11) |
Dec
(6) |
| 2020 |
Jan
(9) |
Feb
(12) |
Mar
(29) |
Apr
(10) |
May
(22) |
Jun
(11) |
Jul
(15) |
Aug
(5) |
Sep
(6) |
Oct
(7) |
Nov
(7) |
Dec
(13) |
| 2021 |
Jan
(21) |
Feb
(5) |
Mar
(5) |
Apr
(6) |
May
(10) |
Jun
(7) |
Jul
(6) |
Aug
(8) |
Sep
(5) |
Oct
(9) |
Nov
(5) |
Dec
(6) |
| 2022 |
Jan
(5) |
Feb
(4) |
Mar
(8) |
Apr
(6) |
May
(5) |
Jun
(5) |
Jul
(10) |
Aug
(6) |
Sep
(7) |
Oct
(4) |
Nov
(4) |
Dec
(6) |
| 2023 |
Jan
(5) |
Feb
(5) |
Mar
(6) |
Apr
(4) |
May
(5) |
Jun
(6) |
Jul
(5) |
Aug
(5) |
Sep
(5) |
Oct
(5) |
Nov
(7) |
Dec
(8) |
| 2024 |
Jan
(3) |
Feb
(1) |
Mar
|
Apr
(2) |
May
|
Jun
(1) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2025 |
Jan
|
Feb
(2) |
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2026 |
Jan
|
Feb
(1) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Brian Z. <bz...@ig...> - 2001-02-13 15:21:10
|
Robert,
I'm +1 for adding the destroy() on destroy() and reset().
brian
-----Original Message-----
From: jyt...@li...
[mailto:jyt...@li...]On Behalf Of Robert W.
Bill
Sent: Tuesday, February 13, 2001 1:47 PM
To: jyt...@li...
Subject: [Jython-dev] PyServlet destroy, ns
Hi all,
Just curious- is it reasonable to add a destroy() for the PyServlets.
Something like:
public void destroy()
{
Enumeration e =3D cache.keys();
while (e.hasMoreElements()) {
CacheEntry ce =3D e.getNext();
HttpServlet pyServlet =3D (HttpServlet)ce.servlet;
pyServlet.destroy();
}
}
Not this code, it's just the quickest example, but a destroy
would be nice if a PyServlet wants to do something specific when
unloaded.
If this is something good, should reset() call destroy() on PyServlets
as
part of the reset, in case they do something important in destroy()?
On an unrelated note, module global variables are common in the Jython
world. Is there an advantage to PyServlet if each servlet has it's own
namespace to accomodate this? It would mean a PyDict for each servlet,
is
that wasteful for just module globals? Also, is it possible to use the
Py
methods directly so you can use things like:
Py.exec(PyObject o, PyObject globals, PyObject locals)
instead of interp.exec("code in ns")?
Thanks,
-Robert
_______________________________________________
Jython-dev mailing list
Jyt...@li...
http://lists.sourceforge.net/lists/listinfo/jython-dev
|
|
From: Samuele P. <pe...@in...> - 2001-02-13 15:07:41
|
Hi. > > It seems to work, but I think we should have some kind of direct API for > this purpose. > > PySystemState.add_classpath(String directoryPath) > PySystemState.add_extdirs(String directoryPath) > > Any thoughs, Samuele? For me it's ok to add those methods as "official" wrappers for the related logics in the PackageManager hierarchy. They will form a family together with add_package. regards, Samuele Pedroni. |
|
From: Robert W. B. <rb...@di...> - 2001-02-13 14:49:17
|
Hi all,
Just curious- is it reasonable to add a destroy() for the PyServlets.
Something like:
public void destroy()
{
Enumeration e = cache.keys();
while (e.hasMoreElements()) {
CacheEntry ce = e.getNext();
HttpServlet pyServlet = (HttpServlet)ce.servlet;
pyServlet.destroy();
}
}
Not this code, it's just the quickest example, but a destroy
would be nice if a PyServlet wants to do something specific when
unloaded.
If this is something good, should reset() call destroy() on PyServlets as
part of the reset, in case they do something important in destroy()?
On an unrelated note, module global variables are common in the Jython
world. Is there an advantage to PyServlet if each servlet has it's own
namespace to accomodate this? It would mean a PyDict for each servlet, is
that wasteful for just module globals? Also, is it possible to use the Py
methods directly so you can use things like:
Py.exec(PyObject o, PyObject globals, PyObject locals)
instead of interp.exec("code in ns")?
Thanks,
-Robert
|
|
From: <bc...@wo...> - 2001-02-13 09:58:40
|
[Brian Zhou]
>If I write:
>
>def init(self):
> # do something
> pass
>
>I got: TypeError: init() too many arguments; expected 1 got 2
>
>If I write:
>
>def init(self, config):
> javax.servlet.http.HttpServlet.init(self, config) # line 14, want
>to do super.init(config) here
> # do something
> pass
>
>I got:
>line 14, in init
>TypeError: init() not enough arguments; expected 2 got 1
>
>Am I missing anything?
In java, it is two different methods, but in jython the two methods is
merged into one. In a normal run this method will be called twice, first
with a config param and second (from within GenericServlet.init) without
any parameters.
So the jython method must be prepared to handle both situations:
def init(self, config=None):
if config:
HttpServlet.init(self, config)
pass
Obviously jython is completely defeating the purpose of the
parameter-less init() method:
"""
void init()
A convenience method which can be overridden so that there's no need
to call super.init(config).
"""
In jython, we are forced to deal with both init() methods *and* we have
to call super.init() as well.
regards,
finn
|
|
From: <bc...@wo...> - 2001-02-13 09:57:46
|
[finn] > I have not yet look at this in depth, but I think the classes from lib & > classes are available as classes, but not as jython package namespaces. > You can test this by trying to load a class from withon the .py file > with java.lang.Class.forName(). I guess this should work, but the normal > jython import does not work. [Brian Zhou] >Unfortunately this (try load a <context>/WEB-INF/classes class from jython >servlet with java.lang.Class.forName()) does not work. > >What I'm trying to do actually is putting XMLC (see http://xmlc.enhydra.org) >compiled pages inside <context>. > >From within a jython servlet, "java.class.path" System property value does >not include <context>/WEB-INF/classes at all. So basically jython servlet >has no idea where to get these classes. > >Two observations, if I have testpkg.TestClass under ><context>/WEB-INF/classes: > >1. I happen to place org.python.util.PyServlet under tomcat_home/classes, if >I add >try { > Class.forName("testpkg.TestClass").newInstance(); >} >catch (Exception ex) { > System.err.println(e.toString()); >} >to PyServlet.java, class loading fails. Right, but I'm not going to add any special support for this. The PyServlet class (and the rest of jython.jar) should be placed under the <context>/WEB-INF/lib. >2. If I add the above code to a servlet within the same <context>, it loads >okay. Right, and it will load ok from within a jython script too. >Which is reasonable, but also suggests that servlet class loading does >something special when within a <context>. PyServlet need to borrow the same >logic. PyServlet will get the logic for free from the classloader that loaded jython.jar (but only when jython.jar is loaded from <context>/WEB-INF/lib). What we need to add is only the inspection of classes and jars found on ../lib and ../classes. The actual classloading magic is already handled by tomcat's servlet context logic. > I didn't test JSP, but I believe it should be the same as servlet. I have added this to PyServlet: 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"); It seems to work, but I think we should have some kind of direct API for this purpose. PySystemState.add_classpath(String directoryPath) PySystemState.add_extdirs(String directoryPath) Any thoughs, Samuele? regards, finn |
|
From: Brian Z. <bri...@ya...> - 2001-02-13 06:07:43
|
Hi Finn, ----- Original Message ----- From: "Finn Bock" <bc...@wo...> To: <jyt...@li...> Sent: Monday, February 12, 2001 1:37 PM Subject: Re: [Jython-dev] WEB-INF/classes & WEB-INF/lib/*.jar inaccessible in jython servlet > On Mon, 12 Feb 2001 12:08:30 -0800, you wrote: > > >These classes are accessible from java servlet and JSP pages, but not > >from jython servlet. The workaround would be to include those in > >CLASSPATH of tomcat startup script, but... you know. > > I have not yet look at this in depth, but I think the classes from lib & > classes are available as classes, but not as jython package namespaces. > You can test this by trying to load a class from withon the .py file > with java.lang.Class.forName(). I guess this should work, but the normal > jython import does not work. > Unfortunately this (try load a <context>/WEB-INF/classes class from jython servlet with java.lang.Class.forName()) does not work. What I'm trying to do actually is putting XMLC (see http://xmlc.enhydra.org) compiled pages inside <context>. From within a jython servlet, "java.class.path" System property value does not include <context>/WEB-INF/classes at all. So basically jython servlet has no idea where to get these classes. Two observations, if I have testpkg.TestClass under <context>/WEB-INF/classes: 1. I happen to place org.python.util.PyServlet under tomcat_home/classes, if I add try { Class.forName("testpkg.TestClass").newInstance(); } catch (Exception ex) { System.err.println(e.toString()); } to PyServlet.java, class loading fails. 2. If I add the above code to a servlet within the same <context>, it loads okay. Which is reasonable, but also suggests that servlet class loading does something special when within a <context>. PyServlet need to borrow the same logic. I didn't test JSP, but I believe it should be the same as servlet. /Brian > As a temporary workaround you can add the java packages to the jython > package manager yourself with add_package. > > sys.add_package("testpackage") > from testpackage import TestClass > > >Anyway, enough complains. > > > >I take a brief look at tomcat 3.2 source code at > > > > :pserver:an...@ja...:/home/cvspublic/jakarta-tomcat > > /src/share/org/apache/tomcat > > > >context/LoaderInterceptor.java seems to be where it adds WEB-INF/classes > >and WEB-INF/lib/*.jar to the classloader class repositories. > > > >Can we do similar things in PyServlet.java ? > > It should be possible to force the jython package manager to search > these two wellknown places for java classes and packages. Perhaps by > setting python.packages.paths and python.packages.directories. Perhaps > by calling the package manager directly. More on later. > > regards, > finn > > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-dev > |
|
From: Brian Z. <bri...@ya...> - 2001-02-13 05:36:25
|
Hi Robert and list,
----- Original Message -----
From: "Robert W. Bill" <rb...@di...>
To: "Brian Zhou" <bri...@ya...>
Cc: <jyt...@li...>
Sent: Monday, February 12, 2001 11:46 PM
Subject: Re: [Jython-dev] jython servlet init() override problem
> Hi Brian,
>
> On Mon, 12 Feb 2001, Brian Zhou wrote:
> > If I write:
> >
> > def init(self):
> > # do something
> > pass
> >
> > I got: TypeError: init() too many arguments; expected 1 got 2
>
> This is referring to the line "def init(self):". PyServlet uses
> 'servlet.init(getServletConfig());', so this is expected. Using the
> parameterless init() is impossible as is.
>
I see. Is that because
HttpServlet.init(self)
HttpServlet.init(self, config)
are difficult to differentiate in jython? I guess it's difficult, but still
possible to do. Unlike
TestClass.m(self, aString)
TestClass.m(self, aFloat)
which is understandably impossible.
> > > If I write:
> >
> > def init(self, config):
> > javax.servlet.http.HttpServlet.init(self, config) # line 14, want
> > to do super.init(config) here
> > # do something
> > pass
> >
> > I got:
> > line 14, in init
> > TypeError: init() not enough arguments; expected 2 got 1
>
> This error is referring to
> "javax.servlet.http.HttpServlet.init(self,config)" not the same
> "def init" line as above.
>
> I thought it might help to point out that the two errors are
> unrelated.
>
> If PyServlet invoked the parameterless init "servlet.init();" on the
> Jython class, then it seems likely that getInitParameters and
> getInitParameterNames still work, and the config would be available
> with getServletConfig. If that works, would people be ok with pre-2.1
> servlet being out of luck?
>
> -Robert
>
Just tried using servlet.init() in PyServlet, it broke snoop.py and threw
NullPointerException. I guess the parmeterless HttpServlet.init() is only
meant to be overriden or be called by HttpServlet.init(config).
The question now becomes: why "HttpServlet.init(self, config)" on line 14
got TypeError? Isn't this the way python code calls super.method()?
Regards,
/Brian
|
|
From: John M. <mu...@im...> - 2001-02-13 03:39:23
|
FYI: The installer says "java version is too old" on HP-UX with Java 1.3. I was able to install on my Linux box so I just tarred up the files, installed manually on HP, edited the "jython" script and it seems to work okay. $ java -version java version "JavaVM-1.3.0.00" Java(TM) 2 Runtime Environment, Standard Edition (build jinteg:11/28/00-11:08) HotSpot VM (build 1.0.1fcs jinteg:11/28/00-13:54 PA2.0, mixed mode) $ $ CLASSPATH=$CLASSPATH:$(pwd) $ java jython-20 try path /new1/mudd/ can not get flavour null for os 'HP-UX' Warning: Cannot convert string "-monotype-arial-medium-r-normal--*-140-75-75-p-*-iso8859-1" to type FontStruct HP-UX B.11.00 A 9000/889 |
|
From: Robert W. B. <rb...@di...> - 2001-02-13 02:49:49
|
Hi Brian, On Mon, 12 Feb 2001, Brian Zhou wrote: > If I write: > > def init(self): > # do something > pass > > I got: TypeError: init() too many arguments; expected 1 got 2 This is referring to the line "def init(self):". PyServlet uses 'servlet.init(getServletConfig());', so this is expected. Using the parameterless init() is impossible as is. > > If I write: > > def init(self, config): > javax.servlet.http.HttpServlet.init(self, config) # line 14, want > to do super.init(config) here > # do something > pass > > I got: > line 14, in init > TypeError: init() not enough arguments; expected 2 got 1 This error is referring to "javax.servlet.http.HttpServlet.init(self,config)" not the same "def init" line as above. I thought it might help to point out that the two errors are unrelated. If PyServlet invoked the parameterless init "servlet.init();" on the Jython class, then it seems likely that getInitParameters and getInitParameterNames still work, and the config would be available with getServletConfig. If that works, would people be ok with pre-2.1 servlet being out of luck? -Robert |
|
From: Brian Z. <bri...@ya...> - 2001-02-13 01:17:16
|
If I write:
def init(self):
# do something
pass
I got: TypeError: init() too many arguments; expected 1 got 2
If I write:
def init(self, config):
javax.servlet.http.HttpServlet.init(self, config) # line 14, want
to do super.init(config) here
# do something
pass
I got:
line 14, in init
TypeError: init() not enough arguments; expected 2 got 1
Am I missing anything?
/Brian
|
|
From: <bc...@wo...> - 2001-02-12 21:38:12
|
On Mon, 12 Feb 2001 12:08:30 -0800, you wrote:
>These classes are accessible from java servlet and JSP pages, but not
>from jython servlet. The workaround would be to include those in
>CLASSPATH of tomcat startup script, but... you know.
I have not yet look at this in depth, but I think the classes from lib &
classes are available as classes, but not as jython package namespaces.
You can test this by trying to load a class from withon the .py file
with java.lang.Class.forName(). I guess this should work, but the normal
jython import does not work.
As a temporary workaround you can add the java packages to the jython
package manager yourself with add_package.
sys.add_package("testpackage")
from testpackage import TestClass
>Anyway, enough complains.
>
>I take a brief look at tomcat 3.2 source code at
>
> :pserver:an...@ja...:/home/cvspublic/jakarta-tomcat
> /src/share/org/apache/tomcat
>
>context/LoaderInterceptor.java seems to be where it adds WEB-INF/classes
>and WEB-INF/lib/*.jar to the classloader class repositories.
>
>Can we do similar things in PyServlet.java ?
It should be possible to force the jython package manager to search
these two wellknown places for java classes and packages. Perhaps by
setting python.packages.paths and python.packages.directories. Perhaps
by calling the package manager directly. More on later.
regards,
finn
|
|
From: Brian Z. <bri...@ya...> - 2001-02-12 20:08:13
|
These classes are accessible from java servlet and JSP pages, but not
from jython servlet. The workaround would be to include those in
CLASSPATH of tomcat startup script, but... you know.
Anyway, enough complains.
I take a brief look at tomcat 3.2 source code at
:pserver:an...@ja...:/home/cvspublic/jakarta-tomcat
/src/share/org/apache/tomcat
context/LoaderInterceptor.java seems to be where it adds WEB-INF/classes
and WEB-INF/lib/*.jar to the classloader class repositories.
Can we do similar things in PyServlet.java ?
Thanks,
/Brian
|
|
From: <bc...@wo...> - 2001-02-12 09:55:51
|
[Jayson S Baird]
>Here is a crude python program for example purposes:
> for each i in <some list>
> print i
>
> with that, will a straight PythonInterpreter.exec(line) by a good enough
>shell interpreter for doing on the fly python interpreting? Or is there
>more higher level stuff to be done?
The PythonInterpreter.exec(s) takes an entire script, not individual
lines. The little example script can be embedded like this:
import org.python.core.*;
import org.python.util.*;
public class si2 {
public static void main(String[] args) {
PythonInterpreter interp = new PythonInterpreter();
interp.exec("for i in (1,2,3):\n print i");
}
}
Note that the script contains newlines and indentation *exactly* as it
would, if it came from a file:
for i in (1,2,3):
print i
regards,
finn
|
|
From: Jayson S B. <js...@ci...> - 2001-02-12 07:33:54
|
Here is a crude python program for example purposes: for each i in <some list> print i with that, will a straight PythonInterpreter.exec(line) by a good enough shell interpreter for doing on the fly python interpreting? Or is there more higher level stuff to be done? Jay |
|
From: Brian Z. <bri...@ya...> - 2001-02-11 18:42:34
|
See below. ----- Original Message ----- From: "Stephen Fay" <ste...@ea...> To: <jyt...@li...> Sent: Wednesday, February 07, 2001 6:45 PM Subject: [Jython-dev] Help > > > My job requires me to write automated > test sequences. > It's usu. called test scenario, test case and test suite. > I believe they plan to use Jython for > this purpose. > Excellent choice if your project is using java. Best of both worlds. > I can read scripts okay. They make sense. > > I am ignorant of (but not limited to ) > the following: > > Java > Java script > Java beans > Java anything > Python > Jython > JPython > It would be helpful if you can figure out the relationship among the above first. In short: * Java runs on JVM (java virtual machine); * Java script does not have much to do with Java, a seperate scripting language; * Java beans is not a language, it's a component architecture so one program can figure out how other component is structured; * Python is an OO dynamic scripting language * Jython is a python implementation on top of JVM, so it can interact with java program * JPython is the old name/version of Jython > I just need some starting point lower > than what I have seen > on Jython.org > * http://www.amk.ca/bookstore/python.html Get the "Learning Python" book, IMHO it's good. * PyUnit unit test framework: http://pyunit.sourceforge.net/ * DDJ jpython article: http://www.ddj.com/articles/1999/9904/9904toc.htm (search for jpython on the page) Once you have jython installed, try some examples from http://www.ddj.com/ftp/1999/1999_04/jpython.txt It even has a lightweight unit test framework included. > Thanks > Stephen Fay > Jython dummy > In the future, this kind of question better be directed to [jython-users] list. Regards, /Brian |
|
From: <bc...@wo...> - 2001-02-10 11:13:37
|
[Brian Zhou]
>I'm using tomcat-3.2.1 on winNT/2k and linux.
>
>Testing dispatch.SimpleIncludeServlet under
>tomcat_home/webapps/WEB-INF/classes/
>
> http://localhost:8080/test/servlet/dispatch.SimpleIncludeServlet
>
>works perfectly fine, which returns
>
>LINE1
>TARGET1
>LINE2
>TARGET1
>LINE3
>
>in a text file.
>
>But when I translated it into jython servlet using:
>
># SimpleInclude.py
>import javax
>
>class SimpleInclude(javax.servlet.http.HttpServlet):
>
> def doGet(self, request, response):
> response.setContentType("text/plain")
> writer = response.getWriter()
> writer.println("LINE1")
> self.context = self.getServletConfig().getServletContext()
> s = "/Target1.py"
> rd = self.context.getRequestDispatcher(s)
> rd.include(request, response)
> writer.println("LINE2")
> rd.include(request, response)
> writer.println("LINE3")
>
># Target1.py
>import javax
>class Target1(javax.servlet.http.HttpServlet):
> def doGet(self, request, response):
> response.setContentType("text/plain")
> writer = response.getWriter()
> writer.println("TARGET1")
>
>All I got is a browser full of LINE1, and then tomcat died.
Thanks for the fine example. It fails for me too (tomcat-4.0m5).
>As a matter of fact, if I just want to rd.include a static page, it
>works fine.
>
>I think it must somehow get into a recursive and got stack overflown.
Correct.
Since the included resource is a .py file, the request is send to
PyServlet. Surprisingly (to me atleast) the request.getServletPath() is
still set to "/SimpleInclude.py". Instead I found the target path as
request.getAttribute("javax.servlet.include.servlet_path").
Does anyone know how the servlet docs describe this? Should PyServlet
check for the "..servlet_path" attribute and use that instead of the
request.getServletPath() when available?
It seems to work, but my knownledge about servlets is too small to be
sure. I have checked in this change so we can experiment with it.
regards,
finn
|
|
From: Brian Z. <bri...@ya...> - 2001-02-09 23:40:44
|
----- Original Message -----
From: "Finn Bock" <bc...@wo...>
To: <jyt...@li...>
Sent: Thursday, February 08, 2001 1:48 PM
Subject: Re: [Jython-dev] sys.path in PyServlet [was: PyServlet]
> [Brian Zhou]
>
>
snipped.
> The ../lib and ../classes directories both have a well defined meaning
> already, so I don't think that they are good candidates for sys.path
> entries.
>
> <context>/WEB-INF/modules/ perhaps?
>
I agree that <context>/WEB-INF/lib and <context>/WEB-INF/classes seem be
reserved. And kind of like the idea of using <context>/WEB-INF/modules .
But I also think that making it more explicit would help avoid future
conflict, such as with Bistro or Rhino. How about just use
<context>/WEB-INF/jython
Regards,
/Brian
|
|
From: Brian Z. <bri...@ya...> - 2001-02-09 20:53:36
|
I'm using tomcat-3.2.1 on winNT/2k and linux.
Testing dispatch.SimpleIncludeServlet under
tomcat_home/webapps/WEB-INF/classes/
http://localhost:8080/test/servlet/dispatch.SimpleIncludeServlet
works perfectly fine, which returns
LINE1
TARGET1
LINE2
TARGET1
LINE3
in a text file.
But when I translated it into jython servlet using:
# SimpleInclude.py
import javax
class SimpleInclude(javax.servlet.http.HttpServlet):
def doGet(self, request, response):
response.setContentType("text/plain")
writer = response.getWriter()
writer.println("LINE1")
self.context = self.getServletConfig().getServletContext()
s = "/Target1.py"
rd = self.context.getRequestDispatcher(s)
rd.include(request, response)
writer.println("LINE2")
rd.include(request, response)
writer.println("LINE3")
# Target1.py
import javax
class Target1(javax.servlet.http.HttpServlet):
def doGet(self, request, response):
response.setContentType("text/plain")
writer = response.getWriter()
writer.println("TARGET1")
All I got is a browser full of LINE1, and then tomcat died.
As a matter of fact, if I just want to rd.include a static page, it
works fine.
I think it must somehow get into a recursive and got stack overflown.
Just want to see if anyone has an idea what is going on.
Thanks,
/Brian
|
|
From: Brian Z. <bri...@ya...> - 2001-02-09 18:53:05
|
I verified David's reload(module) approach works great. Thanks. /Brian ----- Original Message ----- From: "David Syer" <ds...@al...> To: <jyt...@li...> Sent: Friday, February 09, 2001 3:42 AM Subject: RE: [Jython-dev] PyServlet enhancement request > > > 1) We set an "pyservlet" attribute in the req object that > > references the > > PyServlet dispatcher, and > > 2) We add a reset() method to PyServlet. > > Isn't this more complicated thab it needs to be? The servlet.py is under > the control of the developer, and is checked against a cache to see if it > has changed. If developer changes a dependent module all s/he has to do is > insert a 'reload X' statement in servlet.py. > > Dave. > > _______________________________________________ > Jython-dev mailing list > Jyt...@li... > http://lists.sourceforge.net/lists/listinfo/jython-dev > |
|
From: David S. <ds...@al...> - 2001-02-09 11:42:11
|
> 1) We set an "pyservlet" attribute in the req object that > references the > PyServlet dispatcher, and > 2) We add a reset() method to PyServlet. Isn't this more complicated thab it needs to be? The servlet.py is under the control of the developer, and is checked against a cache to see if it has changed. If developer changes a dependent module all s/he has to do is insert a 'reload X' statement in servlet.py. Dave. |
|
From: <bc...@wo...> - 2001-02-09 11:07:28
|
[Jayson S Baird] >Hiho, > > I'm a developer who is trying to embed Python code into Java, so of >course I came to Jython. When trying to run your example after compiling, >I get the following stack dump: > Exception in thread "main" java.lang.NullPointerException > at org.python.core.PyJavaClass.lookup(PyJavaClass.java:39) > at org.python.core.PyObject.<init>(PyObject.java:46) > at org.python.core.PySingleton.<init>(PySingleton.java:8) > at org.python.core.PyNone.<init>(PyNone.java:7) > at org.python.core.PySystemState.initStaticFields(PySystemState.java:341) > at org.python.core.PySystemState.initialize(PySystemState.java:320) > at org.python.core.PySystemState.initialize(PySystemState.java:294) > at org.python.core.PySystemState.initialize(PySystemState.java:287) > at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:61) > at org.python.util.PythonInterpreter.<init>(PythonInterpreter.java:45) > at SimpleEmbedded.main(SimpleEmbedded.java:6) > >Any idea what's causing this? no one has mentioned it in the FAQ's or the >list archives... It works for me: d:\java\jython-2.0\demo\embed>echo %CLASSPATH% d:\java\jython-2.0\jython.jar;. d:\java\jython-2.0\demo\embed>i:\java\jdk1.3\bin\java.exe SimpleEmbedded Hello, brave new world sys module 42 x: 4 Goodbye, cruel world d:\java\jython-2.0\demo\embed> More info is needed about your platform, software version and env-vars before we can give any advice about the situation you are seeing. regards, finn |
|
From: <bc...@wo...> - 2001-02-09 11:01:38
|
[Brian Zhou]
>If we have a servlet.py that uses module.py, PyServlet only detects
>modification date of servlet.py but not any dependency modules.
>
>I don't expect an easy fix for managing all the dependencies. Instead
>I'm thinking maybe it would be helpful to just notify PyServlet to
>discard all the cache and use a new interpreter instance? Now I have to
>restart the servlet container to achieve that.
>
>Ideas?
How about:
1) We set an "pyservlet" attribute in the req object that references the
PyServlet dispatcher, and
2) We add a reset() method to PyServlet.
With these changes users can add a reset.py page with something like
this:
from javax.servlet.http import HttpServlet
class reset(HttpServlet):
def doGet(self, req, res):
req.getAttribute("pyservlet").reset()
req.getRequestDispatcher("/index.py").forward(req, res)
The reset() method contains:
public void reset() {
interp = new PythonInterpreter(null, new PySystemState());
cache.clear();
}
which will blow away both the name space and the sys.modules. This kind
of resetting is meant only as a crude debugging tool. There is certainly
state hidden away in static initializers and caches which is not reset
by this simple call.
regards,
finn
|
|
From: Brian Z. <bri...@ya...> - 2001-02-08 23:29:18
|
If we have a servlet.py that uses module.py, PyServlet only detects modification date of servlet.py but not any dependency modules. I don't expect an easy fix for managing all the dependencies. Instead I'm thinking maybe it would be helpful to just notify PyServlet to discard all the cache and use a new interpreter instance? Now I have to restart the servlet container to achieve that. Ideas? /Brian |
|
From: <bc...@wo...> - 2001-02-08 21:49:28
|
[Brian Zhou]
>> >You could add getServletContext().getRealPath("/") to sys.path in
>PyServlet
>> >in the constructor.
>>
>> A good idea. That should take care of most issues with the application
>> part of sys.path.
>
>Does that mean servlet.py will import module (a non-servlet helper
>python module) from <context>/module.py? Why not add
>contextRoot/WEB-INF/classes to sys.path instead? I know module.py is not
>really a java class, but at least it's invisible from browser client.
>
>Where should I really put this module.py? <context>/WEB-INF/lib/ or
><context>/WEB-INF/classes/?
It's a good question (meaning that I don't have a good answer). In
addition to <context>/, the <context>/WEB-INF/lib/Lib is also included
on sys.path, but non of these places are good for the type of python
modules that must be invisible from browser client.
The ../lib and ../classes directories both have a well defined meaning
already, so I don't think that they are good candidates for sys.path
entries.
<context>/WEB-INF/modules/ perhaps?
regards,
finn
|
|
From: Brian Z. <bri...@ya...> - 2001-02-08 21:05:52
|
> >You could add getServletContext().getRealPath("/") to sys.path in
PyServlet
> >in the constructor.
>
> A good idea. That should take care of most issues with the application
> part of sys.path.
Does that mean servlet.py will import module (a non-servlet helper
python module) from <context>/module.py? Why not add
contextRoot/WEB-INF/classes to sys.path instead? I know module.py is not
really a java class, but at least it's invisible from browser client.
Where should I really put this module.py? <context>/WEB-INF/lib/ or
<context>/WEB-INF/classes/?
Regards,
/Brian
----- Original Message -----
From: "Finn Bock" <bc...@wo...>
To: <jyt...@li...>
Sent: Monday, February 05, 2001 12:17 PM
Subject: [Jython-dev] PyServlet
> [In a private conversation David Syer raised several good points about
> PyServlet. Forgive me for taking the private discussion to the list]
>
> >You could add getServletContext().getRealPath("/") to sys.path in
PyServlet
> >in the constructor.
>
> A good idea. That should take care of most issues with the application
> part of sys.path.
>
> In addition to this, I suggest that we add a fake __file__ attribute
to
> the globals before loading the .py file and before calling the
service()
> method. That way the main .py will know where it is located during
load.
>
> >Does [the fact sys.prefix is null in PyServlet] explain why the
cachedir
> >is created in a weird place (the web-apps directory, not
<path-to-jython.jar>)?
>
> Exactly.
>
> I've already added the init-params as jython options, so we in web.xml
> can do:
>
> * <init-param>
> * <param-name>python.home</param-name>
> * <param-value>/usr/home/jython-2.0</param-value>
> * </init-param>
>
> to set python.home and all the other registry properties.
Unfortunately
> this is mostly useless if we want to set a path to something relative
to
> the webapps folder. And most of the times, that is exactly what we
want.
>
> So I suggest that unless a specific python.home is set in init-param
or
> System.getProperties(), PyServlet will set python.home to
> <context>/WEB-INF/lib. This means the jython.jar, the registry file
and
> the ./Lib directory can be distributed in WEB-INF/lib.
>
> regards,
> finn
>
> _______________________________________________
> Jython-dev mailing list
> Jyt...@li...
> http://lists.sourceforge.net/lists/listinfo/jython-dev
>
|