From f448002f10072ccc98a5e2ed4c89c83df40a21bf Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Fri, 31 Aug 2012 17:27:57 +0900
Subject: [PATCH] Fix error message of StringAttributeMatch Constraint
 incorrectly renamed after migration to ZODB (78e2ae3).

---
 .../StringAttributeMatchConstraint.py         |   8 +-
 .../StringAttributeMatchConstraint_view.xml   |   3 +-
 ...> my_message_attribute_does_not_match.xml} |   4 +-
 .../my_message_property_not_set.xml           | 101 ------------------
 .../ERP5/bootstrap/erp5_core/bt/change_log    |   3 +
 product/ERP5/bootstrap/erp5_core/bt/revision  |   2 +-
 ...age_attribute_does_not_match_property.xml} |   4 +-
 .../erp5_property_sheets/bt/change_log        |   3 +
 .../erp5_property_sheets/bt/revision          |   2 +-
 9 files changed, 17 insertions(+), 113 deletions(-)
 rename product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/{my_message_attribute_match.xml => my_message_attribute_does_not_match.xml} (94%)
 delete mode 100644 product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_property_not_set.xml
 rename product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StringAttributeMatchConstraint/{message_attribute_match_property.xml => message_attribute_does_not_match_property.xml} (85%)

diff --git a/product/ERP5/Document/StringAttributeMatchConstraint.py b/product/ERP5/Document/StringAttributeMatchConstraint.py
index e433526ab3..7d0f3b9bd9 100644
--- a/product/ERP5/Document/StringAttributeMatchConstraint.py
+++ b/product/ERP5/Document/StringAttributeMatchConstraint.py
@@ -39,9 +39,7 @@ class StringAttributeMatchConstraint(PropertyExistenceConstraint):
     regular expression.
   """
   property_sheets = PropertyExistenceConstraint.property_sheets + \
-                               (PropertySheet.StringAttributeMatchConstraint,) 
-
-  _message_id_tuple = ('message_attribute_match',)
+      (PropertySheet.StringAttributeMatchConstraint,) 
 
   def _checkConsistency(self, obj, fixit=0):
     """Check the object's consistency.
@@ -62,8 +60,10 @@ class StringAttributeMatchConstraint(PropertyExistenceConstraint):
           # Generate error
           error_list.append(self._generateError(
                        obj, 
-                       self._getMessage("message_attribute_match"),
+                       self._getMessage("message_attribute_does_not_match"),
             mapping=dict(attribute_name=property_id,
                          attribute_value=repr(current_value),
                          regular_expression=repr(regular_expression))))
     return error_list
+
+  _message_id_tuple = ('message_attribute_does_not_match',)
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view.xml
index cb470745df..49688b5484 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view.xml
@@ -107,8 +107,7 @@
                     <value>
                       <list>
                         <string>my_message_no_such_property</string>
-                        <string>my_message_property_not_set</string>
-                        <string>my_message_attribute_match</string>
+                        <string>my_message_attribute_does_not_match</string>
                       </list>
                     </value>
                 </item>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_attribute_match.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_attribute_does_not_match.xml
similarity index 94%
rename from product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_attribute_match.xml
rename to product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_attribute_does_not_match.xml
index 5992258024..0b499c6e88 100644
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_attribute_match.xml
+++ b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_attribute_does_not_match.xml
@@ -17,7 +17,7 @@
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>my_message_attribute_match</string> </value>
+            <value> <string>my_message_attribute_does_not_match</string> </value>
         </item>
         <item>
             <key> <string>message_values</string> </key>
@@ -90,7 +90,7 @@
                 </item>
                 <item>
                     <key> <string>title</string> </key>
-                    <value> <string>Error Message if Property Matchs the Regexp</string> </value>
+                    <value> <string>Error Message if Property does not Match the Regexp</string> </value>
                 </item>
               </dictionary>
             </value>
diff --git a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_property_not_set.xml b/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_property_not_set.xml
deleted file mode 100644
index ec35a99f37..0000000000
--- a/product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/StringAttributeMatchConstraint_view/my_message_property_not_set.xml
+++ /dev/null
@@ -1,101 +0,0 @@
-<?xml version="1.0"?>
-<ZopeData>
-  <record id="1" aka="AAAAAAAAAAE=">
-    <pickle>
-      <global name="ProxyField" module="Products.ERP5Form.ProxyField"/>
-    </pickle>
-    <pickle>
-      <dictionary>
-        <item>
-            <key> <string>delegated_list</string> </key>
-            <value>
-              <list>
-                <string>display_width</string>
-                <string>title</string>
-              </list>
-            </value>
-        </item>
-        <item>
-            <key> <string>id</string> </key>
-            <value> <string>my_message_property_not_set</string> </value>
-        </item>
-        <item>
-            <key> <string>message_values</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>external_validator_failed</string> </key>
-                    <value> <string>The input failed the external validator.</string> </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>overrides</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>field_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>target</string> </key>
-                    <value> <string></string> </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>tales</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>field_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
-                    <value> <string></string> </value>
-                </item>
-                <item>
-                    <key> <string>target</string> </key>
-                    <value> <string></string> </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-        <item>
-            <key> <string>values</string> </key>
-            <value>
-              <dictionary>
-                <item>
-                    <key> <string>display_width</string> </key>
-                    <value> <int>20</int> </value>
-                </item>
-                <item>
-                    <key> <string>field_id</string> </key>
-                    <value> <string>my_string_field</string> </value>
-                </item>
-                <item>
-                    <key> <string>form_id</string> </key>
-                    <value> <string>Base_viewFieldLibrary</string> </value>
-                </item>
-                <item>
-                    <key> <string>target</string> </key>
-                    <value> <string>Click to edit the target</string> </value>
-                </item>
-                <item>
-                    <key> <string>title</string> </key>
-                    <value> <string>Error Message if Property is not Set</string> </value>
-                </item>
-              </dictionary>
-            </value>
-        </item>
-      </dictionary>
-    </pickle>
-  </record>
-</ZopeData>
diff --git a/product/ERP5/bootstrap/erp5_core/bt/change_log b/product/ERP5/bootstrap/erp5_core/bt/change_log
index be36622885..fa93bfb5ab 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/change_log
+++ b/product/ERP5/bootstrap/erp5_core/bt/change_log
@@ -1,3 +1,6 @@
+2012-09-04 arnaud.fontaine
+* message_attribute_does_not_match was incorrectly renamed to message_attribute_match when migrating StringAttributeMatch constraint from filesystem to ZODB.
+
 2012-07-20 tatuya
 * Set max_row 0 on IdTool_zGetValueList so that we can get all the records of portal_ids table when there are more than 1000 id_group.
 
diff --git a/product/ERP5/bootstrap/erp5_core/bt/revision b/product/ERP5/bootstrap/erp5_core/bt/revision
index 62b51a0067..ee532f37f7 100644
--- a/product/ERP5/bootstrap/erp5_core/bt/revision
+++ b/product/ERP5/bootstrap/erp5_core/bt/revision
@@ -1 +1 @@
-41081
\ No newline at end of file
+41082
\ No newline at end of file
diff --git a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StringAttributeMatchConstraint/message_attribute_match_property.xml b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StringAttributeMatchConstraint/message_attribute_does_not_match_property.xml
similarity index 85%
rename from product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StringAttributeMatchConstraint/message_attribute_match_property.xml
rename to product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StringAttributeMatchConstraint/message_attribute_does_not_match_property.xml
index 84387063cc..21268e116a 100644
--- a/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StringAttributeMatchConstraint/message_attribute_match_property.xml
+++ b/product/ERP5/bootstrap/erp5_property_sheets/PropertySheetTemplateItem/portal_property_sheets/StringAttributeMatchConstraint/message_attribute_does_not_match_property.xml
@@ -22,7 +22,7 @@
         </item>
         <item>
             <key> <string>id</string> </key>
-            <value> <string>message_attribute_match_property</string> </value>
+            <value> <string>message_attribute_does_not_match_property</string> </value>
         </item>
         <item>
             <key> <string>portal_type</string> </key>
@@ -30,7 +30,7 @@
         </item>
         <item>
             <key> <string>property_default</string> </key>
-            <value> <string>python: \'Attribute ${attribute_name} is ${attribute_value} and matches ${regular_expression}\'</string> </value>
+            <value> <string>python: \'Attribute ${attribute_name} is ${attribute_value} and does not match ${regular_expression}\'</string> </value>
         </item>
       </dictionary>
     </pickle>
diff --git a/product/ERP5/bootstrap/erp5_property_sheets/bt/change_log b/product/ERP5/bootstrap/erp5_property_sheets/bt/change_log
index 22dcffb2f4..495a60c5b6 100644
--- a/product/ERP5/bootstrap/erp5_property_sheets/bt/change_log
+++ b/product/ERP5/bootstrap/erp5_property_sheets/bt/change_log
@@ -1,3 +1,6 @@
+2012-09-04 arnaud.fontaine
+* message_attribute_does_not_match was incorrectly renamed to message_attribute_match when migrating StringAttributeMatch constraint from filesystem to ZODB.
+
 2012-03-07 arnaud.fontaine
 * Add property to define preferred source code editor to Preference Property Sheets.
 
diff --git a/product/ERP5/bootstrap/erp5_property_sheets/bt/revision b/product/ERP5/bootstrap/erp5_property_sheets/bt/revision
index 2b82dfea30..eebd1d10b6 100644
--- a/product/ERP5/bootstrap/erp5_property_sheets/bt/revision
+++ b/product/ERP5/bootstrap/erp5_property_sheets/bt/revision
@@ -1 +1 @@
-60
\ No newline at end of file
+61
\ No newline at end of file
-- 
2.30.9