Commit 687f5b43 authored by Michal Čihař's avatar Michal Čihař

Simplify error handling for anonymous user

The error message is usually not useful at all and this code causes
false positive in current PyLint.
parent f9fec320
...@@ -662,13 +662,11 @@ def create_groups(update): ...@@ -662,13 +662,11 @@ def create_groups(update):
anon_user.set_unusable_password() anon_user.set_unusable_password()
anon_user.groups.clear() anon_user.groups.clear()
anon_user.groups.add(guest_group) anon_user.groups.add(guest_group)
except IntegrityError as error: except:
raise ValueError( raise ValueError(
'Anonymous user ({}) already exists and enabled, ' 'Anonymous user ({}) already exists and enabled, '
'please change ANONYMOUS_USER_NAME setting.\n' 'please change ANONYMOUS_USER_NAME setting.'.format(
'Raised error was: {!r}'.format(
ANONYMOUS_USER_NAME, ANONYMOUS_USER_NAME,
error
) )
) )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment