David Fraser
davidf at sjsoft.com
Tue Jun 10 12:46:41 EST 2003
Sean Reifschneider wrote: >On Tue, Jun 10, 2003 at 09:12:46AM +0200, David Fraser wrote: > > >>Do you mean you're using this import mechanism when you have the problem >>with jotweb.input.Request below? >> >> >I mean that the imp module call is loading a module which then does an >"import jotweb.input". If in the jotweb I don't have the __init__.py >import all sub-packages or sub-modules, I will get an AttributeError >such as: > > AttributeError: 'module' object has no attribute 'input' > > >>> import Request >>> >>> >>Have you tried using __all__ = [Request, ...] in __init__.py ? >> >> >I believe I did try that at one point, but it's my understanding that >setting "__all__" only has an impact if you do "from jotweb import *", >which I don't do anywhere. Also, as I said before, I can import the >code fine outside of mod_python. "python -c 'import jotweb.input'", for >example... > > >>mod_python does have some import hooks to handle things specially, but >>I'm not an expect here, someone else will have to comment... >> >> >I wonder if I'm running into something there. I've tried simplifying it >to: > > include current directory in path > module = __import__(basename, globals(), locals(), []) > return sys.path to old layout > >that doesn't really seem to help the problem with imports though... > > Hmmm ... sorry, no further ideas here... >>How do you pass the request object into processLogin (it doesn't seem to >>be part of the call)? >>It seems like you may be trying to use an old request object or something... >> >> > >The request object is stored into a module, where other parts of my >system will pick it up when they need either the headers or the request. > > Might need to be careful of thread safety etc here... >I've verified that the id() of the header_out object is the same in the >higher-level and lower-level code. I'm not calling request.write() >anywhere except at the end of my top-level code, nor am I doing a print >anywhere. I guess it might be a problem with SimpleTAL? It's not going >to access the Apache request object, but maybe it's doing a print? > I don't know much about SimpleTAL, but from what you've described, that's where you need to investigate ... Try wrapping the req object in another one which logs any calls to req.write and then pass that through to SimpleTAL? >>No. But it is a bit more complex running a python interpreter inside >>Apache than standalone. >> >> > >Sure, I understand that, and I'm ok with it being more complicated. I'm >just not happy about running into sporadic problems where sometimes >things work, sometimes they don't. > >For example, *ANY* time I submit a request for a URL via a telnet >connection, I get the headers back: > > guin:jafo$ telnet 127.0.0.1 80 > Trying 127.0.0.1... > Connected to 127.0.0.1. > Escape character is '^]'. > GET http://127.0.0.1/jotweb/sessionex.html?Username=jafo&Password=abc123&loginbutton=1 HTTP/1.0 > > HTTP/1.0 200 OK > Date: Tue, 10 Jun 2003 08:10:44 GMT > Server: Apache/2.0.40 (Red Hat Linux) > Set-cookie: sessionid=20d315c26c8c395e61730ceb27d0faa98fd; Comment="User Login Cookie"; Path=/; Version=1; > Cache-control: max-age=0 > Expires: Thu, 01 Dec 1994 16:00:00 GMT > Content-Length: 405 > Connection: close > Content-Type: text/html; charset=ISO-8859-1 > > [...] > >If I paste the URL: > > http://127.0.0.1/jotweb/sessionex.html?Username=jafo&Password=abc123&loginbutton=1 > >into Konqueror, the headers I'm getting back are: > > Date: Tue, 10 Jun 2003 08:10:44 GMT > Server: Apache/2.0.40 (Red Hat Linux) > Connection: close > Content-Type: text/html; charset=ISO-8859-1 > >(according to Konqueror). I've tried Mozilla and galeon as well, all >with similar results. Yes, I have cookies enabled from localhost. If I >put the headers_out.add() at the top of my handler, it showes up in >Konqueror's "View Page Info" output... > Yikes ... bizarre ... no ideas other than setting up something that watches the actual socket through which the message goes, to see what the difference is Hope somebody else can help... David
|