Registered User?

20 views
Skip to first unread message

Martin Weissenboeck

unread,
Feb 11, 2020, 3:02:56 AM2/11/20
to web2py-users

py4web 0.1.20200210.2 installed
Created "myapp" from scaffold

Error:

Traceback (most recent call last):
  File "C:\Python37\lib\site-packages\py4web\core.py", line 547, in wrapper
    ret = func(*func_args, **func_kwargs)
  File "C:\Python37\lib\site-packages\py4web\core.py", line 508, in wrapper
    ret = func(*args, **kwargs)
  File "apps\myapp\controllers.py", line 36, in index
    message = T("Hello {first_name}".format(**user))
KeyError: 'first_name'

I think the app needs at first a registered user, but @authenticated() does not ask for.

@authenticated()
def index():
    user = auth.get_user()
    message = T("Hello {first_name}".format(**user))
    return dict(message=message, user=user)

Regards Martin

Martin Weissenboeck

unread,
Feb 11, 2020, 3:26:52 AM2/11/20
to web2py-users
Ok, I have found an answer.
There has been another open app (myapp1) in this browser window.
py4web users myapp1, does not ask for a login and tries to get the user from myapp.

i think this behavior is not wanted.

I summarize: a user is registered on app1. If app2 is now opened, no new login is required.
Reply all
Reply to author
Forward
0 new messages