entity.py
branch3.5
changeset 2920 64322aa83a1d
parent 2877 e469f3602858
child 2931 17224e90a1c4
equal deleted inserted replaced
2919:662f35236d1c 2920:64322aa83a1d
   161 
   161 
   162     # class attributes that must be set in class definition
   162     # class attributes that must be set in class definition
   163     id = None
   163     id = None
   164     rest_attr = None
   164     rest_attr = None
   165     fetch_attrs = None
   165     fetch_attrs = None
   166     skip_copy_for = ()
   166     skip_copy_for = ('in_state',)
   167     # class attributes set automatically at registration time
   167     # class attributes set automatically at registration time
   168     e_schema = None
   168     e_schema = None
   169 
   169 
   170     MODE_TAGS = set(('link', 'create'))
   170     MODE_TAGS = set(('link', 'create'))
   171     CATEGORY_TAGS = set(('primary', 'secondary', 'generic', 'generated')) # , 'metadata'))
   171     CATEGORY_TAGS = set(('primary', 'secondary', 'generic', 'generated')) # , 'metadata'))
   483             # skip already defined relations
   483             # skip already defined relations
   484             if getattr(self, rschema.type):
   484             if getattr(self, rschema.type):
   485                 continue
   485                 continue
   486             if rschema.type in self.skip_copy_for:
   486             if rschema.type in self.skip_copy_for:
   487                 continue
   487                 continue
   488             if rschema.type == 'in_state':
       
   489                 # if the workflow is defining an initial state (XXX AND we are
       
   490                 # not in the managers group? not done to be more consistent)
       
   491                 # don't try to copy in_state
       
   492                 if execute('Any S WHERE S state_of ET, ET initial_state S,'
       
   493                            'ET name %(etype)s', {'etype': str(self.e_schema)}):
       
   494                     continue
       
   495             # skip composite relation
   488             # skip composite relation
   496             if self.e_schema.subjrproperty(rschema, 'composite'):
   489             if self.e_schema.subjrproperty(rschema, 'composite'):
   497                 continue
   490                 continue
   498             # skip relation with card in ?1 else we either change the copied
   491             # skip relation with card in ?1 else we either change the copied
   499             # object (inlined relation) or inserting some inconsistency
   492             # object (inlined relation) or inserting some inconsistency