← Back to team overview

oship-dev team mailing list archive

[Branch ~oship-dev/oship/devel] Rev 501: Fixed conflict on Link class.

 

Merge authors:
  Eduardo César <edu@starforge>
------------------------------------------------------------
revno: 501 [merge]
committer: Diego Manhães Pinheiro <dmpinheiro@xxxxxxxxx>
branch nick: trunk
timestamp: Sat 2010-10-09 21:37:32 -0300
message:
  Fixed conflict on Link class.
added:
  src/oship/openehr/rm/common/archetyped/tests/link.txt
modified:
  src/oship/openehr/rm/common/archetyped/__init__.py


--
lp:oship
https://code.launchpad.net/~oship-dev/oship/devel

Your team OSHIP Development Team is subscribed to branch lp:oship.
To unsubscribe from this branch go to https://code.launchpad.net/~oship-dev/oship/devel/+edit-subscription
=== modified file 'src/oship/openehr/rm/common/archetyped/__init__.py'
--- src/oship/openehr/rm/common/archetyped/__init__.py	2010-10-01 14:52:27 +0000
+++ src/oship/openehr/rm/common/archetyped/__init__.py	2010-10-10 00:37:32 +0000
@@ -1,6 +1,8 @@
 #!/usr/bin/env python
 # -*- coding: UTF-8 -*-
 
+import persistent
+
 import grok
 from interfaces import *
 
@@ -212,37 +214,32 @@
         self.originalContent=orgcontent
 
 
-class Link(object):
-    """
-    The LINK type defines a logical relationship between two items, such as two
-    ENTRYs or an ENTRY and a COMPOSITION. Links can be used across composi-
-    tions, and across EHRs. Links can potentially be used between interior
-    (i.e. non archetype root) nodes, although this probably should be prevented
-    in archetypes. Multiple LINKs can be attached to the root object of any
-    archetyped structure to give the effect of a 1->N link 1:1 and 1:N
-    relationships between archetyped content elements (e.g. ENTRYs) can be
-    expressed by using one, or more than one, respectively, DV_LINKs. Chains of
-    links can be used to see "problem threads" or other logical groupings of
-    items. Links should be between archetyped structures only, i.e. between
-    objects representing complete domain concepts because relationships between
-    sub-elements of whole concepts are not necessarily meaningful, and may be
-    downright confusing. Sensible links only exist between whole ENTRYs,
-    SECTIONs, COMPOSITIONs and so on. """
+class Link(persistent.Persistent):
 
     grok.implements(ILink)
 
     def __init__(self, meaning, type_, target):
 
         self.meaning=meaning
-        self.type_=type_
+        self.type=type_
         self.target=target
+        self.meaningValid()
+        self.typeValid()
+        self.targetValid()
 
-    def meaningValid():
+    def meaningValid(self):
         """Return meaning is not None """
+        if self.meaning is None:
+            raise ValueError(u'meaning cannot be None')
 
-    def typeValid():
+    def typeValid(self):
         """Return type is not None """
+        if self.type is None:
+            raise ValueError(u'type cannot be None')
 
-    def targetValid():
+    def targetValid(self):
         """Return target is not None """
-        
+        if self.target is None:
+            raise ValueError(u'target cannot be None')
+
+

=== added file 'src/oship/openehr/rm/common/archetyped/tests/link.txt'
--- src/oship/openehr/rm/common/archetyped/tests/link.txt	1970-01-01 00:00:00 +0000
+++ src/oship/openehr/rm/common/archetyped/tests/link.txt	2010-10-04 01:23:57 +0000
@@ -0,0 +1,9 @@
+>>> from oship.openehr.rm.common.archetyped import Link
+
+>>> l = Link(1,2,3)
+>>> l.meaning
+1
+>>> l.type
+2
+>>> l.target
+3