plone/Products.PloneLanguageTool — pull request #1 by weberlar (2012-01-05 17:30:21+00:00)
Title: prevent UnboundLocalError for unasigned variable lang when switchLanguage is called without parameters

Open e.g. http://plone.org/switchLanguage to see the error; it will result in a log entry like following:

2012-01-05T11:06:00 ERROR Zope.SiteErrorLog 1325757960.350.592968307284 http://www.WHATEVER.TH/E/URL/switchLanguage
Traceback (innermost last):
Module ZPublisher.Publish, line 126, in publish
Module ZPublisher.mapply, line 77, in mapply
Module ZPublisher.Publish, line 46, in call_object
Module Products.CMFCore.FSPythonScript, line 130, in __call__
Module Shared.DC.Scripts.Bindings, line 322, in __call__
Module Shared.DC.Scripts.Bindings, line 359, in _bindAndExec
Module Products.PythonScripts.PythonScript, line 344, in _exec
Module script, line 9, in switchLanguage
-
- Line 9
UnboundLocalError: local variable 'lang' referenced before assignment