r13533 - ArchGenXML/trunk/src/archgenxml

"JS" <[email protected]> Mon, 28 Mar 2011 13:03:51 +0000
Newsgroups gmane.comp.web.zope.plone.archetypes.cvs
Message-ID <[email protected]>
Author: jihaisse
Date: Mon Mar 28 13:03:50 2011
New Revision: 13533

Modified:
   ArchGenXML/trunk/src/archgenxml/ArchetypesGenerator.py
Log:
generation of tools : depends of UniqueObject and SimpleItem. Not a content type anymore and not added in the portal_catalog.

Modified: ArchGenXML/trunk/src/archgenxml/ArchetypesGenerator.py
==============================================================================
--- ArchGenXML/trunk/src/archgenxml/ArchetypesGenerator.py	(original)
+++ ArchGenXML/trunk/src/archgenxml/ArchetypesGenerator.py	Mon Mar 28 13:03:50 2011
@@ -260,7 +260,8 @@
         res = BaseGenerator.generateDependentImports(self, element)
         print >> out, res
 
-        if not element.hasStereoType(self.adapter_stereotypes,umlprofile=self.uml_profile):
+        if not element.hasStereoType(self.adapter_stereotypes,umlprofile=self.uml_profile) and \
+            not element.hasStereoType(self.portal_tools, umlprofile=self.uml_profile):
             print >> out, TEMPLATE_CMFDYNAMICVIEWFTI_IMPORT
 
         generate_expression_validator = False
@@ -1152,7 +1153,8 @@
                                  umlprofile=self.uml_profile):
             print >> outfile, EXTENDER_SCHEMA_START
         else:
-            print >> outfile, SCHEMA_START
+            if not element.hasStereoType(self.portal_tools, umlprofile=self.uml_profile):
+                print >> outfile, SCHEMA_START
         print >> outfile, fieldsformatted.encode('utf8')
 
         marshaller = element.getTaggedValue('marshaller')
@@ -1163,7 +1165,8 @@
                                  umlprofile=self.uml_profile):
             print >> outfile, '    ]\n'
         else:
-            print >> outfile, '),\n)\n'
+            if not element.hasStereoType(self.portal_tools, umlprofile=self.uml_profile):
+                print >> outfile, '),\n)\n'
 
         if asString:
             return outfile.getvalue()
@@ -1622,13 +1625,15 @@
         if not parent_is_archetype and \
            self.getOption('use_dynamic_view', element, True) and \
            not element.hasStereoType(self.atct_stereotype,
-                                     umlprofile=self.uml_profile):
+                                     umlprofile=self.uml_profile) and \
+           not element.hasStereoType(self.portal_tools, umlprofile=self.uml_profile):
             parentnames.append('BrowserDefaultMixin')
 
         # if a parent is already an archetype we dont need a baseschema!
         if parent_is_archetype:
             baseclass = None
-
+        if element.hasStereoType(self.portal_tools, umlprofile=self.uml_profile):
+            baseclass = None
         # remember support
         if element.hasStereoType(self.remember_stereotype,
                                  umlprofile=self.uml_profile):
@@ -1794,7 +1799,7 @@
         # a tool needs to be a unique object
         if element.hasStereoType(self.portal_tools, umlprofile=self.uml_profile):
             print >> outfile, TEMPL_TOOL_HEADER
-            parentnames.insert(0, 'UniqueObject')
+            parentnames.insert(0, 'UniqueObject, SimpleItem')
 
         # protected section
         self.generateProtectedSection(outfile, element, 'module-header')
@@ -1838,15 +1843,16 @@
             schema += ['schema']
 
             schemaName = '%s_schema' % name
-            print >> outfile, utils.indent(schemaName + ' = ' + \
+            if not element.hasStereoType(self.portal_tools, umlprofile=self.uml_profile):
+                print >> outfile, utils.indent(schemaName + ' = ' + \
                                            ' + \\\n    '.join(['%s.copy()' % s\
                                                                for s in schema]), 0)
 
-            # move fields based on move: tagged values
-            self.generateFieldMoves(outfile, schemaName, field_specs)
+                # move fields based on move: tagged values
+                self.generateFieldMoves(outfile, schemaName, field_specs)
 
-            # protected section
-            self.generateProtectedSection(outfile, element, 'after-schema')
+                # protected section
+                self.generateProtectedSection(outfile, element, 'after-schema')
 
             # [optilude] It's possible parents may become empty now...
             parents = ', '.join(parentnames)
@@ -1951,7 +1957,8 @@
                 wrt(utils.indent('return self.schema',2) + '\n\n')
         else:
             # schema attribute
-            wrt(utils.indent('schema = %s' % schemaName, 1) + '\n\n')
+            if not element.hasStereoType(self.portal_tools, umlprofile=self.uml_profile):
+                wrt(utils.indent('schema = %s' % schemaName, 1) + '\n\n')
 
         # Set base_archetype for remember
         if element.hasStereoType(self.remember_stereotype,
@@ -1988,7 +1995,8 @@
         # [optilude] Don't register type for abstract classes or tools or for schema extenders
         if not element.isAbstract() and \
            not element.hasStereoType('mixin',umlprofile=self.uml_profile) and \
-           not element.hasStereoType(self.adapter_stereotypes,umlprofile=self.uml_profile):
+           not element.hasStereoType(self.adapter_stereotypes,umlprofile=self.uml_profile) and \
+           not element.hasStereoType(self.portal_tools,umlprofile=self.uml_profile):
             wrt(REGISTER_ARCHTYPE % name)
 
         # ATVocabularyManager: registration of class
@@ -4204,6 +4212,7 @@
 
             if pclass.hasStereoType(self.flavor_stereotypes,umlprofile=self.uml_profile) \
                or pclass.hasStereoType(self.adapter_stereotypes,umlprofile=self.uml_profile) \
+               or pclass.hasStereoType(self.portal_tools,umlprofile=self.uml_profile) \
                or pclass.hasStereoType(['interface']):
                 continue
 

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar