Skip to content

Commit

Permalink
fix sequence of format() and babel translation
Browse files Browse the repository at this point in the history
  • Loading branch information
UlrichB22 committed Mar 1, 2024
1 parent 4082d18 commit 925fe26
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/moin/apps/admin/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@ def mail_recovery_token():
if not is_ok:
flash(msg, "error")
else:
flash(_("{0} has been sent a password recovery email.".format(username)), "info")
flash(_("{0} has been sent a password recovery email.").format(username), "info")
else:
flash(_("{0} is an invalid user, no email has been sent.".format(username)), "error")
flash(_("{0} is an invalid user, no email has been sent.").format(username), "error")
else:
flash(_("No user name provided, no email sent."), "error")
return redirect(url_for('.userbrowser'))
Expand Down
2 changes: 1 addition & 1 deletion src/moin/items/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1394,7 +1394,7 @@ def meta_changed(self, meta):
def do_modify(self):
if isinstance(self.content, NonExistentContent) and not flaskg.user.may.create(self.name):
abort(403, description=' '
+ _('You do not have permission to create the item named "{name}".'.format(name=self.name)))
+ _('You do not have permission to create the item named "{name}".').format(name=self.name))

method = request.method
if method in ['GET', 'HEAD']:
Expand Down
2 changes: 1 addition & 1 deletion src/moin/items/ticket.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def _dump(self, item):
else:
original = meta.get(key)
new = value
msg = L_('{key} changed from {original} to {new}'.format(key=key, original=original, new=new))
msg = L_('{key} changed from {original} to {new}').format(key=key, original=original, new=new)
meta_changes.append(' * ' + msg)
if meta_changes:
meta_changes = 'Meta updates:\n' + '\n'.join(meta_changes)
Expand Down
4 changes: 2 additions & 2 deletions src/moin/macros/ItemList.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def macro(self, content, arguments, page_url, alternative):
# verify item exists and current user has read permission
if item != "":
if not flaskg.storage.get_item(**(split_fqname(item).query)):
message = _('Item does not exist or read access blocked by ACLs: {0}'.format(item))
message = _('Item does not exist or read access blocked by ACLs: {0}').format(item)
admonition = moin_page.div(attrib={moin_page.class_: 'important'},
children=[moin_page.p(children=[message])])
return admonition
Expand All @@ -136,7 +136,7 @@ def macro(self, content, arguments, page_url, alternative):
try:
regex_re = re.compile(regex, re.IGNORECASE)
except re.error as err:
raise ValueError(_("ItemList macro: Error in regex {0!r}: {1}".format(regex, err)))
raise ValueError(_("ItemList macro: Error in regex {0!r}: {1}").format(regex, err))
newlist = []
for child in children:
if regex_re.search(child.fullname):
Expand Down
4 changes: 2 additions & 2 deletions src/moin/storage/middleware/indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1230,9 +1230,9 @@ def store_revision(self, meta, data, overwrite=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(
raise ValueError(_('Error: metadata validation failed, invalid field value(s) = {0}').format(
', '.join(val)
)))
))

# we do not have anything in m that is not defined in the schema,
# e.g. userdefined meta keys or stuff we do not validate. thus, we
Expand Down

0 comments on commit 925fe26

Please sign in to comment.