plynx-team / plynx

PLynx is a domain agnostic platform for managing reproducible experiments and data-oriented workflows.
https://plynx.com
Apache License 2.0
301 stars 37 forks source link

fix register_user call in _init_default_user #83

Closed Nostix closed 4 years ago

Nostix commented 4 years ago

Fix error created by wrong method call on first startup in single user mode.

Stacktrace: api | INFO:root:Single user mode api | File "/usr/local/bin/plynx", line 33, in api | File "/usr/local/lib/python3.7/site-packages/plynx-1.5.0-py3.7.egg/plynx/bin/init.py", line 13, in main api | args.func(kwargs) api | File "/usr/local/lib/python3.7/site-packages/plynx-1.5.0-py3.7.egg/plynx/bin/cli.py", line 26, in api api | run_api(**args) api | File "/usr/local/lib/python3.7/site-packages/plynx-1.5.0-py3.7.egg/plynx/web/common.py", line 160, in run_api api | _init_default_user() api | File "/usr/local/lib/python3.7/site-packages/plynx-1.5.0-py3.7.egg/plynx/web/common.py", line 111, in _init_default_user api | message = register_user(DEFAULT_EMAIL, DEFAULT_USERNAME, DEFAULT_PASSWORD) api | File "/usr/local/lib/python3.7/site-packages/plynx-1.5.0-py3.7.egg/plynx/web/common.py", line 72, in register_user api | error_code=RegisterUserExceptionCode.EMPTY_USERNAME api | plynx.utils.exceptions.RegisterUserException: Missing username

khaxis commented 4 years ago

Good catch, thanks!

Nostix commented 4 years ago

You might also want to take a look at the default values as the validation fails everytime because of the empty password and email strings. Furthermore the register_user function now always returns the user, but the _init_default_user function raises an exeption if the function returns anything. Because of this, even if the user gets registered correctly, an exeption is raised.