From e87547b78936e06a34668035526d1335dc40155f Mon Sep 17 00:00:00 2001 From: Gaetan Delannay Date: Tue, 22 Mar 2011 16:45:46 +0100 Subject: [PATCH] appy.gen: bugfix while comparing values for historization purposes. --- gen/plone25/mixins/__init__.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gen/plone25/mixins/__init__.py b/gen/plone25/mixins/__init__.py index 1297ea4..ef7fbb8 100644 --- a/gen/plone25/mixins/__init__.py +++ b/gen/plone25/mixins/__init__.py @@ -347,9 +347,14 @@ class BaseMixin: prev = previousData[field] appyType = self.getAppyType(field) curr = appyType.getValue(self) - if (prev == curr) or ((prev == None) and (curr == '')) or \ - ((prev == '') and (curr == None)): - del previousData[field] + try: + if (prev == curr) or ((prev == None) and (curr == '')) or \ + ((prev == '') and (curr == None)): + del previousData[field] + except UnicodeDecodeError, ude: + # The string comparisons above may imply silent encoding-related + # conversions that may produce this exception. + pass if (appyType.type == 'Ref') and (field in previousData): previousData[field] = [r.title for r in previousData[field]] if previousData: