← Back to team overview

mlhim-specs-dev team mailing list archive

[Branch ~cdd-dev/cdd/trunk] Rev 290: Corrected CCD.definiton

 

------------------------------------------------------------
revno: 290
committer: Eduardo Ribeiro <xcesar@xxxxxxxxx>
branch nick: devel
timestamp: Thu 2012-12-27 18:00:38 -0200
message:
  Corrected CCD.definiton
modified:
  src/2.0/cdd.py


--
lp:cdd
https://code.launchpad.net/~cdd-dev/cdd/trunk

Your team MLHIM Specifications Developers is subscribed to branch lp:cdd.
To unsubscribe from this branch go to https://code.launchpad.net/~cdd-dev/cdd/trunk/+edit-subscription
=== modified file 'src/2.0/cdd.py'
--- src/2.0/cdd.py	2012-12-07 21:26:53 +0000
+++ src/2.0/cdd.py	2012-12-27 20:00:38 +0000
@@ -2267,12 +2267,9 @@
     def generate_file(self, path):
 
 
-        UUID_definition = "ct-"+str(uuid.uuid4())
-        UUID_string = "ct-"+str(uuid.uuid4())
-        UUID_complex = "ct-"+str(uuid.uuid4())
-
         schema = self.ccd_id + ".xsd"
 
+        # CDD version, transformed. ex: 2.x.y -> 2_x_y
         version = self.rm_version.replace('.','_');
 
         contributors_formated = '<dc:contributor>' + \
@@ -2320,22 +2317,24 @@
 
   <xs:include schemaLocation="http://www.mlhim.org/xmlns/mlhim2/{version}/mlhim2.xsd"/>
 
-  <xs:element name="{ccd_id}" type="mlhim2:{UUID_complex}"/>
-  <xs:complexType name="{UUID_complex}">
+  <xs:element name="{ccd_id}" type="mlhim2:ct-{UUID_complex}"/>
+
+  <xs:complexType name="ct-{UUID_complex}">
     <xs:complexContent>
-    <xs:restriction base="mlhim2:CCDType">
+      <xs:restriction base="mlhim2:CCDType">
 	<xs:sequence>
-	  <xs:element name="definition"  minOccurs="1"  maxOccurs="1" type="mlhim2:{UUID_definition}"/>
+	  <xs:element minOccurs="1"  maxOccurs="1" ref="mlhim2:el-{UUID_definition}"/>
 	</xs:sequence>
-    </xs:restriction>
+      </xs:restriction>
     </xs:complexContent>
   </xs:complexType>
 
+  <xs:element name='el-{UUID_definition}' substitutionGroup="mlhim2:definition" type='mlhim2:ct-{UUID_definition}'/>
+
 </xs:schema>
 """.format(ccd_id = self.ccd_id,
-           UUID_definition = UUID_definition,
-           UUID_DvString = UUID_string,
-           UUID_complex = UUID_complex,
+           UUID_definition = str(uuid.uuid4()),
+           UUID_complex = str(uuid.uuid4()),
 
            title = escape(self.title),
            description = escape(self.description),