[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/zopeappgenerations/ Evolvement script for moved dublincore data

Philipp von Weitershausen philikon at philikon.de
Fri May 12 12:37:55 EDT 2006


Log message for revision 68112:
  Evolvement script for moved dublincore data
  

Changed:
  U   Zope3/trunk/src/zope/app/zopeappgenerations/__init__.py
  A   Zope3/trunk/src/zope/app/zopeappgenerations/evolve5.py

-=-
Modified: Zope3/trunk/src/zope/app/zopeappgenerations/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/zopeappgenerations/__init__.py	2006-05-12 15:45:45 UTC (rev 68111)
+++ Zope3/trunk/src/zope/app/zopeappgenerations/__init__.py	2006-05-12 16:37:54 UTC (rev 68112)
@@ -24,7 +24,7 @@
 
 ZopeAppSchemaManager = SchemaManager(
     minimum_generation=1,
-    generation=4,
+    generation=5,
     package_name=key)
 
 

Added: Zope3/trunk/src/zope/app/zopeappgenerations/evolve5.py
===================================================================
--- Zope3/trunk/src/zope/app/zopeappgenerations/evolve5.py	2006-05-12 15:45:45 UTC (rev 68111)
+++ Zope3/trunk/src/zope/app/zopeappgenerations/evolve5.py	2006-05-12 16:37:54 UTC (rev 68112)
@@ -0,0 +1,42 @@
+##############################################################################
+#
+# Copyright (c) 2006 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Evolve moved Zope Dublin Core Annotatable data
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+from zope.annotation.interfaces import IAnnotatable, IAnnotations
+from zope.dublincore.interfaces import IWriteZopeDublinCore
+from zope.dublincore.annotatableadapter import ZDCAnnotatableAdapter
+from zope.dublincore.annotatableadapter import DCkey
+from zope.app.generations.utility import findObjectsProviding
+from zope.app.zopeappgenerations import getRootFolder
+
+generation = 5
+
+def evolve(context):
+    root = getRootFolder(context)
+    for obj in findObjectsProviding(root, IAnnotatable):
+        dc = IWriteZopeDublinCore(obj)
+        if isinstance(dc, ZDCAnnotatableAdapter):
+            # simply mark the ZDCAnnotationData object as dirty so
+            # that it gets repickled
+            dc._mapping._p_activate()
+            dc._mapping._p_changed = True
+
+            # also mark the object holding a reference to it (the
+            # annotations mapping) as dirty.  It contains a reference
+            # to the old class path for ghosts
+            annotations = IAnnotations(obj)
+            annotations[DCkey] = annotations[DCkey]


Property changes on: Zope3/trunk/src/zope/app/zopeappgenerations/evolve5.py
___________________________________________________________________
Name: svn:keywords
   + Id
Name: svn:eol-style
   + native



More information about the Zope3-Checkins mailing list