[Checkins] SVN: Products.CMFCore/branches/2.2/Products/CMFCore/ give a more useful error message when trying to rename an ImmutableId; pyflakes

David Glick davidglick at onenw.org
Mon Sep 20 01:42:58 EDT 2010


Log message for revision 116642:
  give a more useful error message when trying to rename an ImmutableId; pyflakes

Changed:
  U   Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt
  U   Products.CMFCore/branches/2.2/Products/CMFCore/utils.py

-=-
Modified: Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt	2010-09-20 05:37:02 UTC (rev 116641)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/CHANGES.txt	2010-09-20 05:42:58 UTC (rev 116642)
@@ -4,6 +4,9 @@
 2.2.3 (unreleased)
 ------------------
 
+- Make the error raised when trying to rename an instance of ImmutableId
+  indicate the id of the object.
+
 - DateTime 2.12.5 does away with a special case representing
   DateTime values for midnight (00:00:00) without their time and
   time zone values. So DateTimes formerly rendered as

Modified: Products.CMFCore/branches/2.2/Products/CMFCore/utils.py
===================================================================
--- Products.CMFCore/branches/2.2/Products/CMFCore/utils.py	2010-09-20 05:37:02 UTC (rev 116641)
+++ Products.CMFCore/branches/2.2/Products/CMFCore/utils.py	2010-09-20 05:42:58 UTC (rev 116642)
@@ -30,12 +30,10 @@
 from AccessControl.SecurityManagement import getSecurityManager
 from Acquisition.interfaces import IAcquirer
 from Acquisition import aq_get
-from Acquisition import aq_inner
 from Acquisition import aq_parent
 from Acquisition import Implicit
 from App.class_init import InitializeClass
 from App.Common import package_home
-from App.Dialogs import MessageDialog
 from App.ImageFile import ImageFile
 from App.special_dtml import HTMLFile
 from DateTime.DateTime import DateTime
@@ -401,7 +399,7 @@
         try:
             if_modified_since=long(DateTime(if_modified_since).timeTime())
         except:
-            if_mod_since=None
+            if_modified_since=None
 
     client_etags = None
     if if_none_match:
@@ -496,10 +494,8 @@
         """ Never allow renaming!
         """
         if id != self.getId():
-            raise ValueError(MessageDialog(
-                title='Invalid Id',
-                message='Cannot change the id of this object',
-                action='./manage_main'))
+            raise ValueError('Changing the id of this object is forbidden: %s'
+                             % self.getId())
 
 
 class UniqueObject (ImmutableId):



More information about the checkins mailing list