[Zope-Checkins] SVN: Zope/trunk/ - Deprecated OFSP.Versions.

Christian Theune ct at gocept.com
Fri Nov 26 12:49:45 EST 2004


Log message for revision 28522:
   - Deprecated OFSP.Versions.
  
  

Changed:
  U   Zope/trunk/doc/CHANGES.txt
  U   Zope/trunk/lib/python/AccessControl/Role.py
  U   Zope/trunk/lib/python/Products/OFSP/Version.py
  U   Zope/trunk/lib/python/Products/OFSP/__init__.py
  U   Zope/trunk/lib/python/Products/OFSP/dtml/version.dtml

-=-
Modified: Zope/trunk/doc/CHANGES.txt
===================================================================
--- Zope/trunk/doc/CHANGES.txt	2004-11-26 17:33:58 UTC (rev 28521)
+++ Zope/trunk/doc/CHANGES.txt	2004-11-26 17:49:44 UTC (rev 28522)
@@ -46,6 +46,10 @@
 
     Bugs fixed
 
+      - Removed Version objects from the add menu. Versions are agreed to be a
+        feature that should not be used as it is not well implemented and
+        allows for data loss.
+
       - Collector #1510: Allow encoding of application/xhtml+xml pages
         according to the charset specified in the Content-Type header
         (thanks to Jacek Konieczny for the patch).

Modified: Zope/trunk/lib/python/AccessControl/Role.py
===================================================================
--- Zope/trunk/lib/python/AccessControl/Role.py	2004-11-26 17:33:58 UTC (rev 28521)
+++ Zope/trunk/lib/python/AccessControl/Role.py	2004-11-26 17:49:44 UTC (rev 28522)
@@ -341,13 +341,15 @@
         """Set local roles for a user."""
         if not roles:
             raise ValueError, 'One or more roles must be given!'
-        dict=self.__ac_local_roles__ or {}
+        dict=self.__ac_local_roles__
+        if dict is None:
+            self.__ac_local_roles__ = dict = {}
         local_roles = list(dict.get(userid, []))
         for r in roles:
             if r not in local_roles:
                 local_roles.append(r)
         dict[userid] = local_roles
-        self.__ac_local_roles__=dict
+        self._p_changed=True
         if REQUEST is not None:
             stat='Your changes have been saved.'
             return self.manage_listLocalRoles(self, REQUEST, stat=stat)
@@ -356,20 +358,24 @@
         """Set local roles for a user."""
         if not roles:
             raise ValueError, 'One or more roles must be given!'
-        dict=self.__ac_local_roles__ or {}
+        dict=self.__ac_local_roles__
+        if dict is None:
+            self.__ac_local_roles__ = dict = {}
         dict[userid]=roles
-        self.__ac_local_roles__=dict
+        self._p_changed=True
         if REQUEST is not None:
             stat='Your changes have been saved.'
             return self.manage_listLocalRoles(self, REQUEST, stat=stat)
 
     def manage_delLocalRoles(self, userids, REQUEST=None):
         """Remove all local roles for a user."""
-        dict=self.__ac_local_roles__ or {}
+        dict=self.__ac_local_roles__
+        if dict is None:
+            self.__ac_local_roles__ = dict = {}
         for userid in userids:
             if dict.has_key(userid):
                 del dict[userid]
-        self.__ac_local_roles__=dict
+        self._p_changed=True
         if REQUEST is not None:
             stat='Your changes have been saved.'
             return self.manage_listLocalRoles(self, REQUEST, stat=stat)

Modified: Zope/trunk/lib/python/Products/OFSP/Version.py
===================================================================
--- Zope/trunk/lib/python/Products/OFSP/Version.py	2004-11-26 17:33:58 UTC (rev 28521)
+++ Zope/trunk/lib/python/Products/OFSP/Version.py	2004-11-26 17:49:44 UTC (rev 28522)
@@ -88,6 +88,14 @@
 
         return r
 
+    def om_icons(self):
+        """Return a list of icon URLs to be displayed by an ObjectManager"""
+        return ({'path': 'misc_/OFSP/version.gif',
+                  'alt': self.meta_type, 'title': self.meta_type},
+                 {'path': 'misc_/PageTemplates/exclamation.gif',
+                          'alt': 'Deprecated object',
+                          'title': 'Version objects are deprecated and should not be used anyore.'},)
+
     def manage_edit(self, title, REQUEST=None):
         """ """
         self.title=title

Modified: Zope/trunk/lib/python/Products/OFSP/__init__.py
===================================================================
--- Zope/trunk/lib/python/Products/OFSP/__init__.py	2004-11-26 17:33:58 UTC (rev 28521)
+++ Zope/trunk/lib/python/Products/OFSP/__init__.py	2004-11-26 17:49:44 UTC (rev 28522)
@@ -22,6 +22,7 @@
 from AccessControl.Permissions import add_documents_images_and_files
 from AccessControl.Permissions import add_folders
 from ZClasses import createZClassForBase
+from ImageFile import ImageFile
 
 createZClassForBase( OFS.DTMLMethod.DTMLMethod, globals()
                    , 'ZDTMLMethod', 'DTML Method' )
@@ -39,6 +40,10 @@
 createZClassForBase( AccessControl.User.User, globals()
                    , 'ZUser', 'User' )
 
+misc_={
+    'version.gif':ImageFile('images/version.gif', globals())
+    }
+
 # This is the new way to initialize products.  It is hoped
 # that this more direct mechanism will be more understandable.
 def initialize(context):
@@ -105,13 +110,17 @@
         legacy=(AccessControl.User.manage_addUserFolder,),
         )
 
+    ## Those both classes are relicts. We only withdraw them from the Add menu.
+    ## This way people will stop using them. They are undocumented anyway. 
+    ## People also have the chance to softly migrate their data and stop using the
+    ## versions they still use.
 
-    context.registerClass(
-        Version.Version,
-        constructors=(Version.manage_addVersionForm,
-                      Version.manage_addVersion),
-        icon='images/version.gif'
-        )
+    #context.registerClass(
+    #    Version.Version,
+    #    constructors=(Version.manage_addVersionForm,
+    #                  Version.manage_addVersion),
+    #    icon='images/version.gif'
+    #    )
 
     #context.registerClass(
     #    Draft.Draft,

Modified: Zope/trunk/lib/python/Products/OFSP/dtml/version.dtml
===================================================================
--- Zope/trunk/lib/python/Products/OFSP/dtml/version.dtml	2004-11-26 17:33:58 UTC (rev 28521)
+++ Zope/trunk/lib/python/Products/OFSP/dtml/version.dtml	2004-11-26 17:49:44 UTC (rev 28522)
@@ -1,6 +1,8 @@
 <dtml-var manage_page_header>
 <dtml-var manage_tabs>
 
+<h3 style="color:red;">Version objects are deprecated and should not be used anymore!</h3>
+
 <dtml-if Zope-Version>
 
   <dtml-if expr="_vars['Zope-Version'] != cookie">



More information about the Zope-Checkins mailing list