Skip to content

Commit

Permalink
fix check for exception-message for py3
Browse files Browse the repository at this point in the history
  • Loading branch information
pbauer committed Sep 18, 2018
1 parent a7a9ca5 commit 64f4d7d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions plone/autoform/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from z3c.form.util import expandPrefix

import logging
import six


logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -242,9 +243,13 @@ def _process_field_moves(self, rules):
try:
move(self, name, before=before, after=after, prefix=prefix)
except KeyError as e:
if six.PY2:
message = e.message
else:
message = e.args[0]
if (
e.message.startswith('Field ') and
e.message.endswith(' not found')
message.startswith('Field ') and
message.endswith(' not found')
):
# The relative_to field doesn't exist
logger.warning(
Expand Down

0 comments on commit 64f4d7d

Please sign in to comment.