r13362 - in Products.Marshall/branches/plip10778-plone.uuid: . Products/Marshall/namespaces

"Jean-Michel FRANCOIS" <[email protected]>
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: toutpt
Date: Fri Dec 17 14:46:42 2010
New Revision: 13362

Modified:
   Products.Marshall/branches/plip10778-plone.uuid/Products/Marshall/namespaces/atns.py
   Products.Marshall/branches/plip10778-plone.uuid/setup.py
Log:
implements IUUID pattern in Products.Marshall.

Modified: Products.Marshall/branches/plip10778-plone.uuid/Products/Marshall/namespaces/atns.py
==============================================================================
--- Products.Marshall/branches/plip10778-plone.uuid/Products/Marshall/namespaces/atns.py	(original)
+++ Products.Marshall/branches/plip10778-plone.uuid/Products/Marshall/namespaces/atns.py	Fri Dec 17 14:46:42 2010
@@ -17,6 +17,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 ##################################################################
+from plone.uuid.interfaces import IUUID
 
 """
 Serialize AT Schema Attributes
@@ -246,7 +247,7 @@
 class ArchetypeUID(SchemaAttribute):
 
     def serialize(self, dom, parent_node, instance, options={}):
-        value = getattr(instance, atcfg.UUID_ATTR, "")
+        value = IUUID(instance, '')
         node = dom.createElementNS(Archetypes.xmlns, "uid")
         nvalue = dom.createTextNode(value)
         node.appendChild(nvalue)
@@ -261,7 +262,8 @@
     def resolveUID(self, instance, values):
         assert not isinstance(values, (list, tuple))
         at_uid = values
-        existing = getattr(instance, atcfg.UUID_ATTR, _marker)
+        #existing = getattr(instance, atcfg.UUID_ATTR, _marker)
+        existing = IUUID(instance, _marker)
         if existing is _marker or existing != at_uid:
             ref = Reference(uid=at_uid)
             target = ref.resolve(instance)

Modified: Products.Marshall/branches/plip10778-plone.uuid/setup.py
==============================================================================
--- Products.Marshall/branches/plip10778-plone.uuid/setup.py	(original)
+++ Products.Marshall/branches/plip10778-plone.uuid/setup.py	Fri Dec 17 14:46:42 2010
@@ -34,6 +34,7 @@
       install_requires=[
           'setuptools',
           'transaction',
+          'plone.uuid',
           'zope.contenttype',
           'zope.interface',
           'Products.Archetypes',

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.