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

Location:
mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/examples
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/examples/aquifer.py

    r8074 r8086  
     1 
    12 
    23 
     
    1718 
    1819''' 
    19 Created on 26-Jan-2012 16:07:30 
     20Created on 03-Feb-2012 10:41:16 
    2021 
    2122@author: mnagni 
     
    3940 
    4041 
     42 
     43    def __key(self): 
     44        return (self.content) 
     45 
     46    def __eq__(x, y): 
     47        ''' 
     48        Cannot compare classes which do not define a "__key" attribute  
     49        ''' 
     50        if hasattr(x, '_%s__key' % (type(x).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): 
     51            return x.__key() == y.__key() 
     52        return id(x) == id(y) 
     53 
     54    def __hash__(self): 
     55        return hash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/examples/pallet.py

    r8074 r8086  
     1 
    12 
    23 
     
    1718 
    1819''' 
    19 Created on 26-Jan-2012 16:07:32 
     20Created on 03-Feb-2012 10:41:09 
    2021 
    2122@author: mnagni 
     
    3940 
    4041 
     42 
     43    def __key(self): 
     44        return (self.mass) 
     45 
     46    def __eq__(x, y): 
     47        ''' 
     48        Cannot compare classes which do not define a "__key" attribute  
     49        ''' 
     50        if hasattr(x, '_%s__key' % (type(x).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): 
     51            return x.__key() == y.__key() 
     52        return id(x) == id(y) 
     53 
     54    def __hash__(self): 
     55        return hash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/examples/waterbody.py

    r8074 r8086  
     1 
    12 
    23 
     
    1718 
    1819''' 
    19 Created on 26-Jan-2012 16:07:40 
     20Created on 03-Feb-2012 10:41:13 
    2021 
    2122@author: mnagni 
     
    3940 
    4041 
     42 
     43    def __key(self): 
     44        return (self.salinity) 
     45 
     46    def __eq__(x, y): 
     47        ''' 
     48        Cannot compare classes which do not define a "__key" attribute  
     49        ''' 
     50        if hasattr(x, '_%s__key' % (type(x).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): 
     51            return x.__key() == y.__key() 
     52        return id(x) == id(y) 
     53 
     54    def __hash__(self): 
     55        return hash(self.__key()) 
  • mauRepo/MolesManager/trunk/src/ea_model/iso_19156_2011_observations_and_measurements/examples/well.py

    r8074 r8086  
     1 
    12 
    23 
     
    1718 
    1819''' 
    19 Created on 26-Jan-2012 16:07:41 
     20Created on 03-Feb-2012 10:41:17 
    2021 
    2122@author: mnagni 
     
    3940 
    4041 
     42 
     43    def __key(self): 
     44        return (self.sampledFeature) 
     45 
     46    def __eq__(x, y): 
     47        ''' 
     48        Cannot compare classes which do not define a "__key" attribute  
     49        ''' 
     50        if hasattr(x, '_%s__key' % (type(x).__name__)) and hasattr(y, '_%s__key' % (type(y).__name__)): 
     51            return x.__key() == y.__key() 
     52        return id(x) == id(y) 
     53 
     54    def __hash__(self): 
     55        return hash(self.__key()) 
Note: See TracChangeset for help on using the changeset viewer.