Fascinating.... in gluon/tools.py replace

                if condition and callable(condition):
                    condition = condition()
                if not condition:

with

                if not condition and not (condition and
callable(condition) and condition()):

does the problem go away?

On Oct 18, 7:30 pm, Matthew Young <[email protected]> wrote:
> Hi everyone I am using the following python/web2y versions:
> web2py™       (1, 99, 3, datetime.datetime(2011, 10, 18, 17, 10, 12),
> 'dev')
> Python  Python 2.7: /usr/bin/python
>
> I am running web2py from source under linux.
>
> I have the following method in my default controller file:
> @auth.requires_login()
> def add_recipe():
>     form = crud.create(db.recipe, next=URL('list_recipes'))
>     return dict(form=form)
>
> When I have the decorator, I get the following stack trace when trying
> to access that view:
> Traceback (most recent call last):
>   File "/home/mattosaurus/web2py/gluon/restricted.py", line 192, in
> restricted
>     else:
>   File "/home/mattosaurus/web2py/applications/recipeViewer/controllers/
> default.py", line 105, in <module>
>   File "/home/mattosaurus/web2py/gluon/globals.py", line 149, in
> <lambda>
>     self._caller = lambda f: f()
>   File "/home/mattosaurus/web2py/gluon/tools.py", line 2465, in f
>     """
> UnboundLocalError: local variable 'condition' referenced before
> assignment
>
> I'm not sure what this means, but I know that it goes away if I remove
> the decorator. How can I get this working without removing my
> decorator?
>
> Thank you.

Reply via email to