clean up config error logic and imports

This commit is contained in:
Neil Johnson 2018-10-17 11:36:41 +01:00
parent 1ccafb0c5e
commit c6584f4b5f
3 changed files with 21 additions and 20 deletions

View file

@ -15,11 +15,10 @@
from distutils.util import strtobool
from synapse.config._base import ConfigError
from synapse.types import RoomAlias
from synapse.util.stringutils import random_string_with_symbols
from ._base import Config
from ._base import Config, ConfigError
class RegistrationConfig(Config):
@ -48,7 +47,7 @@ class RegistrationConfig(Config):
self.auto_join_rooms = config.get("auto_join_rooms", [])
for room_alias in self.auto_join_rooms:
if not RoomAlias.is_valid(room_alias):
raise ConfigError('Invalid auto_join_rooms entry %s' % room_alias)
raise ConfigError('Invalid auto_join_rooms entry %s' % (room_alias,))
self.autocreate_auto_join_rooms = config.get("autocreate_auto_join_rooms", True)
def default_config(self, **kwargs):
@ -106,10 +105,10 @@ class RegistrationConfig(Config):
# - "#example:example.com"
# Where auto_join_rooms are specified, setting this flag ensures that the
# the rooms exists by creating them when the first user on the
# the rooms exist by creating them when the first user on the
# homeserver registers.
# Setting to false means that if the rooms are not manually created,
# users cannot be auto joined since they do not exist.
# users cannot be auto-joined since they do not exist.
autocreate_auto_join_rooms: true
""" % locals()