Message6364
When using python 3.5 (probably fails with all python 3s), references to
tal variables sometimes fail.
To reproduce, create the demo tracker.
Change html/issue.item.html
Locate the <table> element near line 42. Change it to this:
<table class="form"
tal:define="user_realnames python:sorted('Kirk,Spock,Uhura,
McCoy,Scotty,Sulu,Chekov,Chapel'.split(','));
bad_expression python:[x for x in context.assignedto
if x.realname not in user_realnames]">
To make things simpler, in the config.ini file, set web.debug=yes.
Do whatever you need to do to deploy these two changes.
Go to the browser and bring up the demo tracker. Click on 'Create New'
in the sidebar, you will get a 'Templating Error' with this detail at
the top of the page:
<class 'NameError'>: name 'user_realnames' is not defined
If you do a browser search for 'user_realnames' it will match the name
in the above error message, with the last match matching the variable
which is actually defined with the correct value.
The problem is that roundup/cgi/PageTemplates/PythonExpr.py tries to
obtain variables referenced in the python expression using this
expression at line 43:
self._f.__code__.co_names
With python 3.5 this expression does not return all variables in the
expression ('context', 'assignedto'). The same code for python 2.7 works
fine and returns all variables in the expression ('context',
'assignedto', 'realname', 'user_realnames').
I am working on a fix for this using the symtable package. I'll post it
here when I'm finished. My proof of concept test code works for both
python 2.7 and 3.5. |
|
Date |
User |
Action |
Args |
2019-03-04 21:04:58 | tekberg | set | recipients:
+ tekberg, rouilj |
2019-03-04 21:04:58 | tekberg | set | messageid: <1551733498.06.0.4167606434.issue2551026@roundup.psfhosted.org> |
2019-03-04 21:04:58 | tekberg | link | issue2551026 messages |
2019-03-04 21:04:57 | tekberg | create | |
|