Exemple #1
0
    def update(self, data):
        if not IEntity.providedBy(data): # pylint: disable=E1101
            prx = DataElementAttributeProxy(data)
            try:
                new_owner = prx.owner
            except AttributeError:
                pass
            else:
                if new_owner != self.owner:
#                current_owner = None if self.owner == '' else self.owner
                    self.__process_change_owner(new_owner)
            try:
                new_delivery_date = prx.delivery_date
            except AttributeError:
                pass
            else:
                self.delivery_date = new_delivery_date
            try:
                jobs = prx.jobs
            except AttributeError:
                pass
            else:
                self.__process_iso_jobs(jobs)
            try:
                isos = prx.isos
            except AttributeError:
                pass
            else:
                self.__process_isos(isos)
Exemple #2
0
 def update(self, entity_class, data, target=None):
     if not IEntity.providedBy(data): # pylint: disable=E1101
         upd_ent = self.__run_traversal(entity_class, data, target,
                                        RELATION_OPERATIONS.UPDATE)
     else:
         upd_ent = SaSession.merge(self, data)
     return upd_ent
Exemple #3
0
 def make_relationship(self, relator, direction=RELATIONSHIP_DIRECTIONS.BIDIRECTIONAL):
     """
     Create a relationship object for this attribute from the given
     relator and relationship direction.
     """
     if IEntity.providedBy(relator):  # pylint:disable=E1101
         rel = DomainRelationship(relator, self, direction=direction)
     elif IResource.providedBy(relator):  # pylint:disable=E1101
         rel = ResourceRelationship(relator, self, direction=direction)
     else:
         raise ValueError(
             'Invalid relator argument "%s" for ' "relationship; must provide IEntity or " "IResource." % relator
         )
     return rel
Exemple #4
0
 def make_relationship(self,
                       relator,
                       direction=RELATIONSHIP_DIRECTIONS.BIDIRECTIONAL):
     """
     Create a relationship object for this attribute from the given
     relator and relationship direction.
     """
     if IEntity.providedBy(relator):  # pylint:disable=E1101
         rel = DomainRelationship(relator, self, direction=direction)
     elif IResource.providedBy(relator):  # pylint:disable=E1101
         rel = ResourceRelationship(relator, self, direction=direction)
     else:
         raise ValueError('Invalid relator argument "%s" for '
                          'relationship; must provide IEntity or '
                          'IResource.' % relator)
     return rel
Exemple #5
0
 def remove(self, entity_class, data):
     if not IEntity.providedBy(data): # pylint: disable=E1101
         self.__run_traversal(entity_class, None, data,
                              RELATION_OPERATIONS.REMOVE)
     else:
         SaSession.delete(self, data)
Exemple #6
0
 def add(self, entity_class, data): # different signature pylint: disable=W0222
     if not IEntity.providedBy(data): # pylint: disable=E1101
         self.__run_traversal(entity_class, data, None,
                              RELATION_OPERATIONS.ADD)
     else:
         SaSession.add(self, data)
Exemple #7
0
 def update(self, data):
     if IEntity.providedBy(data): # pylint: disable=E1101
         self.get_entity().molecule_designs = data.molecule_designs
     else:
         Member.update(self, data)