oship-dev team mailing list archive
-
oship-dev team
-
Mailing list archive
-
Message #01543
[Branch ~oship-dev/oship/devel] Rev 500: Bug #623581 removed unecessary methods and added invariants
------------------------------------------------------------
revno: 500
committer: Eduardo César <edu@starforge>
branch nick: local
timestamp: Sun 2010-10-03 22:23:57 -0300
message:
Bug #623581 removed unecessary methods and added invariants
added:
src/oship/openehr/rm/common/archetyped/tests/link.txt
modified:
src/oship/openehr/rm/common/archetyped/__init__.py
src/oship/openehr/rm/common/archetyped/interfaces.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-09-06 13:32:03 +0000
+++ src/oship/openehr/rm/common/archetyped/__init__.py 2010-10-04 01:23:57 +0000
@@ -1,6 +1,8 @@
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
+import persistent
+
import grok
from interfaces import *
@@ -212,7 +214,7 @@
self.originalContent=orgcontent
-class Link(Locatable):
+class Link(persistent.Persistent):
"""
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-
@@ -231,18 +233,27 @@
grok.implements(ILink)
- def __init__(self, meaning, type_, target):
+ 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 """
-
- def targetValid():
+ if self.type is None:
+ raise ValueError(u'type cannot be None')
+
+ def targetValid(self):
"""Return target is not None """
-
+ if self.target is None:
+ raise ValueError(u'target cannot be None')
+
=== modified file 'src/oship/openehr/rm/common/archetyped/interfaces.py'
--- src/oship/openehr/rm/common/archetyped/interfaces.py 2010-08-06 21:24:11 +0000
+++ src/oship/openehr/rm/common/archetyped/interfaces.py 2010-10-04 01:23:57 +0000
@@ -71,16 +71,7 @@
)
- def meaningValid():
- """Return meaning is not None """
-
- def typeValid():
- """Return type is not None """
-
- def targetValid():
- """Return target is not None """
-
-
+
class IFeederAuditDetails(Interface):
u"""
=== 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