Commit a1c1d13 breaks admin app - proposed fix

51 views
Skip to first unread message

Brian Meredyk

unread,
Oct 5, 2016, 10:12:58 PM10/5/16
to web2py-developers
Looks like the recent commit a1c1d13 breaks the admin app. The problem is at line 313-314 of admin/controllers/default.py. The issue is that f might not be defined and thus regex.match(f) causes a failure. 

<type 'exceptions.UnboundLocalError'> local variable 'f' referenced before assignment

Traceback

1.
2.
3.
4.
5.
6.
7.
8.
9.
Traceback (most recent call last):
File "C:\FMSC Webapps\web2py_master\gluon\restricted.py", line 216, in restricted
exec(ccode, environment)
File "C:\FMSC Webapps\web2py_master\applications\admin\controllers/default.py:site", line 2003, in <module>
File "C:\FMSC Webapps\web2py_master\gluon\globals.py", line 405, in <lambda>
self._caller = lambda f: f()
File "C:\FMSC Webapps\web2py_master\applications\admin\controllers/default.py:site", line 313, in site
UnboundLocalError: local variable 'f' referenced before assignment
I believe that the fix is to change lines 312-316 to the below which gets things working again for me

    if is_manager():
        apps
= [a for a in os.listdir(apath(r=request)) if regex.match(a) and #<<note regex.match(a) not regex.match(f)
                a
!= '__pycache__']
   
else:
        apps
= [a.name for a in db(db.app.owner == auth.user_id).select()]

Niphlod

unread,
Oct 7, 2016, 7:08:46 AM10/7/16
to web2py-developers
yep, it was me.

Niphlod

unread,
Oct 7, 2016, 7:11:42 AM10/7/16
to web2py-developers
https://github.com/web2py/web2py/pull/1494

first PR done directly from the web, without even having any piece of code on the mobile phone ^_^
Hello, github!
Reply all
Reply to author
Forward
0 new messages