[zope2-tracker] [Bug 143429] Re: return with wrong keywords results in wrong error message

David Coe davidc at debian.org
Thu Jan 14 12:13:28 EST 2010


the originally-described problem is more pervasive, and confusing to the
user, than described there.

A valid python script containing a return (e.g. return
RESPONSE.redirect('someplace')) was subsequently edited and a syntax
error was introduced much further down in the script; it was something
like

print "..... %s" % repr(something.replace(a,b), replace(c,d))
where it should have been
print "..... %s" % repr(something.replace(a,b).replace(c,d))

which caused the error: 
'return' outside function (Script (Python))
pointing to the first return with no hint as to where the actual syntax error was.

replacing the return(s) with "raise 'XXX'" or similar valid code allowed
the parser to identify the real error, but doing that is not at all
intuitive.

-- 
return with wrong keywords results in wrong error message
https://bugs.launchpad.net/bugs/143429
You received this bug notification because you are a member of Zope 2
Developers, which is subscribed to Zope 2.


More information about the zope2-tracker mailing list