Ignore:
Timestamp:
03/02/12 13:48:25 (8 years ago)
Author:
mnagni
Message:

Fixed the multiple CI_Party INSERT in the DB
Refactored the ingestion thanks to the new eq method in the imported classes DB library

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19123_2005_coverages/coverages/segmented_curve/cv_valuesegment.py

    r8074 r8086  
     1 
    12 
    23 
     
    1718 
    1819''' 
    19 Created on 26-Jan-2012 16:07:29 
     20Created on 03-Feb-2012 10:41:14 
    2021 
    2122@author: mnagni 
     
    3839        self.endParameter = None 
    3940        self.curve = [] 
     41        self.endValue = None 
    4042        self.startValue = None 
    41         self.endValue = None 
    4243        self.ends = None 
    4344        super(CV_ValueSegment, self).__init__() 
     
    5455 
    5556 
     57 
     58    def __key(self): 
     59        return (self.startParameter, self.endParameter, self.curve, self.endValue, self.startValue, self.ends) 
     60 
     61    def __eq__(x, y): 
     62        ''' 
     63        Cannot compare classes which do not define a "__key" attribute  
     64        ''' 
     65        if hasattr(x, '_%s__key' % (type(x).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): 
     66            return x.__key() == y.__key() 
     67        return id(x) == id(y) 
     68 
     69    def __hash__(self): 
     70        return hash(self.__key()) 
Note: See TracChangeset for help on using the changeset viewer.