diff --git a/src/moin/apps/frontend/views.py b/src/moin/apps/frontend/views.py index 1dc475075..339f87894 100644 --- a/src/moin/apps/frontend/views.py +++ b/src/moin/apps/frontend/views.py @@ -80,7 +80,6 @@ from moin.signalling import item_displayed, item_modified from moin.storage.middleware.protecting import AccessDenied, gen_fqnames from moin.converters import default_registry as reg -# from moin.cli.migration.moin19.import19 import hash_hexdigest from moin.storage.middleware.validation import validate_data import moin.utils.mimetype as mime_type @@ -2397,7 +2396,11 @@ class UserSettingsUIForm(Form): 'verification email failed. Please try again later.'), "error")) else: - flaskg.user.save() + try: + flaskg.user.save() + except ValueError as err: + response['flash'].append((str(err), 'error')) + else: # validation failed response['flash'].append((_("Nothing saved."), "error")) diff --git a/src/moin/storage/middleware/indexing.py b/src/moin/storage/middleware/indexing.py index c3f4a47e1..194e3b99a 100644 --- a/src/moin/storage/middleware/indexing.py +++ b/src/moin/storage/middleware/indexing.py @@ -1221,9 +1221,14 @@ def store_revision(self, meta, data, overwrite=False, logging.warning("data validation skipped because metadata is invalid, see below") val = [] for e in m.children: - logging.warning("{0}, {1}, {2}".format(e.valid, e.name, e.raw)) - if e.valid is False: + if e.name == 'subscriptions': + for sub in e.children: + if sub.valid is False: + val.append('"{}". {}'.format(str(sub), str(sub.errors[0]))) + e.valid = False + elif e.valid is False: val.append(str(e)) + logging.warning("{0}, {1}, {2}".format(e.valid, e.name, e.raw)) if VALIDATION_HANDLING == VALIDATION_HANDLING_STRICT: raise ValueError(_('Error: metadata validation failed, invalid field value(s) = {0}'.format( ', '.join(val)