[mod_python] Built-in function type() unavailable in PSP?

Davin Boling davin at wordpainter.net
Mon Jun 6 14:31:19 EDT 2005


I apologize if this has been asked before in the past, but due to the 
generic nature of the word "type", searching the list history would be a 
headache.

While writing a web form recently, I discovered that the "type" function 
didn't appear to be working properly. Odd. At first I thought I had 
overloaded it by accident with a malformed HTML tag, but after writing a 
test script in PHP from scratch I see that type() isn't working at all.

<%
a = type('')
%>
Testing! <%= str(a) %>


One would expect this to return the textual representation of a type 
object, but nothing was returned at all. I tried manually importing type 
from __builtin__, but that didn't work either.

To further illustrate the problem, I generated an Exception:

<%
a = type('')
raise Exception, str(a)
%>

Result:
Mod_python error: "PythonHandler mod_python.psp"

Traceback (most recent call last):

   File "/usr/lib/python2.3/site-packages/mod_python/apache.py", line 
299, in HandlerDispatch
     result = object(req)

   File "/usr/lib/python2.3/site-packages/mod_python/psp.py", line 297, 
in handler
     p.run()

   File "/usr/lib/python2.3/site-packages/mod_python/psp.py", line 208, 
in run
     exec code in global_scope

   File "/var/www/path/excluded/test.psp", line 3, in ?
     raise Exception, str(a)

Exception:

(Note the lack of data return after "Exception:".)



Any suggestions?


More information about the Mod_python mailing list