Re: error using tags within functions
"Jonathan Ellis" <[email protected]>
| Newsgroups | gmane.comp.python.spyce.general |
|---|---|
| Message-ID | <[email protected]> |
On Sun, 14 May 2006 13:25:02 -0400, "Dustin  " <[email protected]> said: > I'm trying to write my first Spyce project and I'm having an issue when > trying to use active tags within a defined function. Perhaps I'm not > doing > this correctly, but the error I get is: > > Traceback (most recent call last): > File "/usr/share/spyce/spyce.py", line 554, in __init__ > try: exec self.getCode() in self._codeenv > SyntaxError: unqualified exec is not allowed in function 'spyceProcess' > it > contains a nested function with free variables (<string>, line 39) > > Here's what my code looks like (well, it actually looks a lot different, > but > this will create the error): > > [[.taglib from=tags.spi as=form]] > > [[-- PAGE 1 --]] > [[ > def page1(): { > ]] > <html> > <form:lettersonly>test</form:lettersonly> > </html> > [[ > } > > page1() > ]] > > If I don't put the tag within the function, it works fine. What am I > doing > wrong? Is this sort of thing not allowed? There's two things that can cause this: 1) a bug in 2.0 2) using exports in your custom tag 1) is fixed in subversion, pending release in 2.1, but there is no fix for 2) yet; python's exec makes it hard to avoid this problem with sub-functions in .spy files. -J -- C++ is history repeated as tragedy. Java is history repeated as farce. --Scott McKay ------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642