(summary taken from this list post:
http://sourceforge.net/mailarchive/forum.php?thread_id=5894399&forum_id=10008
)
<blockquote><code><pre>
Been a while. Hope things are well for you. Here"s a
problem I just
hit with spyce that seems have been reported before
but not fixed
(http://sourceforge.net/mailarchive/message.php?msg_id=6943358).
If you haven"t fixed it, I can shed some light on it.
The problem is
with mod_python for python 2.3. I just switched from
FastCGI to
mod_python, and my site worked perfectly before and
had problems with
mod_python. So I was pretty sure that mod_python was
the problem.
The problem: mod_python"s apacheRequest.subprocess_env
is no longer a
dict -- it is an mp_table (whatever that is).
mp_table seems to
emulate the behavior of dict, but not exactly. This
statement fails
with mp_table:
if key in mp_table:
With regular python dicts, this statement works and is
equivalent to
"if key in mp_table.keys():". But not so with
mod_python. Apparently
they have failed to customize that method.
My solution: Convert the mod_python mp_table to a real
dict. Your
spyceUtil.py goes like this:
def extractValue(hash, key, default=None):
"""Extract value from dictionary, if it exists.
If key is none, return entire dictionary"""
if key==None: return hash
if hash.has_key(key): return hash[key]
return default
My new one goes like this (see how I"m converting to a
dict with the
dict() method):
def extractValue(hash, key, default=None):
"""Extract value from dictionary, if it exists.
If key is none, return entire dictionary"""
if key==None: return dict(hash)
if hash.has_key(key): return hash[key]
return default
This ensures a real dictionary comes back with all the
methods of a
dict.
</pre></code>
</blockquote>
This is a serious problem, as it means Spyce does not
work correctly with modern Python interpretors and
mod_python, which is the fastest way to run Spyce.
Logged In: YES
user_id=371556
Thanks for reporting the problem. I like your solution. I
have modified it slightly:
if key==None:
if isinstance(hash, dict): return hash
else: return dict(hash)
This change is checked into the CVS already. Please verify
that it works, let me know, and close this bug report if
everything works properly for you. It will be in the next
release.
Logged In: YES
user_id=657828
fixed in subversion, will be in next release.