Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Do not inherit ``node.parts.Reference`` from ``node.parts.UUIDAware``

  • Loading branch information...
commit d7136c39f1a23cbb8f607eb09cf323763d8a056f 1 parent e18e8ca
Robert Niederreiter authored
View
10 README.rst
@@ -281,6 +281,16 @@ Contributors
Changes
=======
+0.9.6dev
+--------
+
+- Do not inherit ``node.parts.Reference`` from ``node.parts.UUIDAware``.
+ [rnix, 2012-01-30]
+
+- Set ``uuid`` in ``node.parts.Reference.__init__`` plumb.
+ [rnix, 2012-01-30]
+
+
0.9.5
-----
View
2  setup.py
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os
-version = '0.9.5'
+version = '0.9.6dev'
shortdesc = "The node"
longdesc = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read()
longdesc += open(os.path.join(os.path.dirname(__file__), 'LICENSE.rst')).read()
View
16 src/node/interfaces.py
@@ -452,8 +452,14 @@ def insertafter(newnode, refnode):
"""
-class IUUIDAware(Interface):
- """Plumbing part providing a uuid on nodes.
+class IUUID(Interface):
+ """Plumbing part for providing a uuid on a node.
+ """
+ uuid = Attribute(u"``uuid.UUID`` of this node.")
+
+
+class IUUIDAware(IUUID):
+ """Be aware of node uuid for several operations.
Plumbing hooks:
@@ -463,7 +469,6 @@ class IUUIDAware(Interface):
copy
Set new uuid on copied obejct. Considers ``overwrite_recursiv_on_copy``.
"""
- uuid = Attribute(u"``uuid.UUID`` of this node.")
overwrite_recursiv_on_copy = Attribute(u"Flag whether to set new UUID on "
u"children as well when calling "
u"``node.copy()``. This only makes "
@@ -479,11 +484,14 @@ def set_uuid_for(node, override=False, recursiv=False):
"""
-class IReference(IUUIDAware):
+class IReference(IUUID):
"""Plumbing part holding an index of all nodes contained in the tree.
Plumbing hooks:
+ __init__
+ Create and set uuid.
+
__setitem__
Set child in index.
View
2  src/node/parts/__init__.py
@@ -15,6 +15,7 @@
GetattrChildren,
NodeChildValidate,
UnicodeAware,
+ UUIDAware,
# Wrap,
)
from node.parts.lifecycle import (
@@ -40,7 +41,6 @@
)
from node.parts.order import Order
from node.parts.reference import (
- UUIDAware,
NodeIndex,
Reference,
)
View
6 src/node/parts/reference.py
@@ -1,3 +1,4 @@
+import uuid
from plumber import (
plumb,
extend,
@@ -10,7 +11,6 @@
INode,
IReference,
)
-from node.parts.common import UUIDAware
class NodeIndex(object):
@@ -29,15 +29,15 @@ def __contains__(self, key):
return int(key) in self._index
-class Reference(UUIDAware):
+class Reference(Part):
implements(IReference)
_uuid = default(None)
@plumb
def __init__(_next, self, *args, **kw):
- # XXX: should be wrapped via property and set on first access
self._index = dict()
+ self.uuid = uuid.uuid4()
_next(self, *args, **kw)
@plumb
Please sign in to comment.
Something went wrong with that request. Please try again.