[Cheetahtemplate-discuss] #set can't unpack tuples
Brought to you by:
rtyler,
tavis_rudd
From: <ms...@oz...> - 2005-08-24 22:12:31
|
This template: #set $x, $y, $z = $range(3) Causes this error: ''' Cheetah.Parser.ParseError: Expected assignment operator at line 1, column 8 in file /tmp/x.tmpl Line|Line contents ----|------------------------------------------------------------- 1 |#set $x, $y, $z = $range(3) ^ ''' If I put parentheses around the left side like this: #set ($x, $y, $z) = $range(3) The compiler doth spit out: ''' File "/usr/local/stow/python-2.4.1/lib/python2.4/site-packages/Cheetah/Parser.py", line 613, in getCheetahVar return self.getCheetahVarBody(plain=plain) File "/usr/local/stow/python-2.4.1/lib/python2.4/site-packages/Cheetah/Parser.py", line 627, in getCheetahVarBody return self._compiler.genCheetahVar(self.getCheetahVarNameChunks(), plain=plain) File "/usr/local/stow/python-2.4.1/lib/python2.4/site-packages/Cheetah/Compiler.py", line 95, in genCheetahVar if nameChunks[0][0] in self.setting('gettextTokens'): IndexError: list index out of range ''' This is with Cheetah 0.9.16 on Python 2.4.1 on Linux. If I downgrade to 0.9.15 on Python 2.3.4, the first error remains the same but the second error changes to: ''' File "/usr/lib/python2.3/site-packages/Cheetah/Parser.py", line 638, in getCheetahVarBody return self.genCheetahVar(self.getCheetahVarNameChunks(), plain=plain) File "/usr/lib/python2.3/site-packages/Cheetah/Compiler.py", line 114, in genCheetahVar return self.genPlainVar(nameChunks) File "/usr/lib/python2.3/site-packages/Cheetah/Compiler.py", line 196, in genPlainVar chunk = nameChunks.pop() IndexError: pop from empty list ''' Removing the $'s has no effect. We have implied if not promised that #set can do all local variable assignments that Python can do, so this is not good. -- -- Mike Orr <ms...@oz...> |