Neil Schemenauer wrote:
> Also, if you could build a self
>contained example, that would help a lot.
>
>
The following code is the smallest (I think) that triggers the bug:
============ __init__.py ===================
import quixote
quixote.enable_ptl
from ptlerror import ptlerror as _q_index
_q_exports = ['_q_index']
============ ptlerror.ptl ====================
import UserDict
def ptlerror [html] (request):
#dct = {'a': 1, 'b': 2, 'c': 3} # works
dct = UserDict.UserDict()
dct['a'], dct['b'], dct['c'] = 1, 2, 3
dct['a'] # works, prints 1
'%(a)s, %(b)s, %(c)s' % dct # fails
The following code *works* (import this instead of ptlerror):
============= noerror.py ===================
import UserDict
def noerror(request):
#dct = {'a': 1, 'b': 2, 'c': 3} # works
dct = UserDict.UserDict()
dct['a'], dct['b'], dct['c'] = 1, 2, 3
dct['a'] # works, prints 1
return '%(a)s, %(b)s, %(c)s' % dct # works
Finally, note that the code fails in a ptl file even if the string
substitution is done in a function imported from a pure python module.
e.g.,
def anothererror [html] (request):
pythonmodule.dostringsubstitution(string, dct) # fails
Thanks,
VanL