Changeset 8222 for mauRepo


Ignore:
Timestamp:
12/04/12 11:42:59 (8 years ago)
Author:
mnagni
Message:

Incomplete - # 22403: CEDA Observation - ceda Internal information
 http://team.ceda.ac.uk/trac/ceda/ticket/22403
Incomplete - # 22428: CEDA Project - observationCollection
 http://team.ceda.ac.uk/trac/ceda/ticket/22428
Complete - # 22397: CEDA Observation geographicExtent
 http://team.ceda.ac.uk/trac/ceda/ticket/22397
Incomplete - # 22385: CEDA Observation - result
 http://team.ceda.ac.uk/trac/ceda/ticket/22385

Location:
mauRepo/MolesManager/trunk/src
Files:
2 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/ea_model/upcomingiso/ci_responsibility.py

    r8197 r8222  
    4343 
    4444        self.extent = [] 
     45        self._party = [] 
    4546        self._party_ci_individual = [] 
    4647        self._party_ci_organisation = [] 
     
    5758 
    5859    @property 
    59     def party(self):     
    60         ret = [] 
    61         for item in self._party_ci_individual: 
    62             ret.append(item) 
    63         for item in self._party_ci_organisation: 
    64             ret.append(item) 
    65         return ret 
     60    def party(self): 
     61        try: 
     62            ret = [] 
     63            ret.extend(self._party_ci_individual) 
     64            ret.extend(self._party_ci_organisation) 
     65            if not hasattr(self, '_party'): 
     66                self._party = [] 
     67            self._party[:] 
     68            self._party.extend(ret) 
     69        except Exception as e: 
     70            pass 
     71        return self._party 
    6672 
     73    ''' 
    6774    @party.setter 
    6875    def party(self, value):      
     
    7885                    self._party_ci_organisation.append(item) 
    7986                    continue 
     87    ''' 
    8088 
    8189    @property 
     
    8694    def role(self, value):       
    8795            self._ci_responsiblepartyinfo.role = value 
     96 
     97    def synchronize(self): 
     98        self._party_ci_individual[:] 
     99        self._party_ci_organisation[:] 
     100        for item in self.party: 
     101            valueClass = "%s.%s" % (type(item).__module__,type(item).__name__) 
     102            if valueClass == "ea_model.upcomingiso.ci_individual.CI_Individual": 
     103                self._party_ci_individual.append(item) 
     104                continue 
     105            if valueClass == "ea_model.upcomingiso.ci_organisation.CI_Organisation": 
     106                self._party_ci_organisation.append(item) 
     107                continue 
    88108 
    89109    def __key(self): 
  • mauRepo/MolesManager/trunk/src/libs/commons_db.py

    r8147 r8222  
    2525        Represents a database instance managed by an SQLAlchemy engine.         
    2626    """ 
    27     def __init__(self, connection, script): 
     27    def __init__(self, connection, script = None): 
    2828        """ 
    2929          :param connection: the URL used to open a connection to the database 
     
    3434        self._script = script 
    3535        self._engine = create_engine(self._connection, echo=True) 
    36         if (self._script): 
     36        self._session = None 
     37        if self._script: 
    3738            self._script(self._metadata) 
    38             #execfile(self._script, {'metadata': DbManager._metadata, 'engine': self._engine}) 
    3939            self._metadata.create_all(bind=self._engine) 
    40         self._session = scoped_session(sessionmaker(bind=self._engine))     
     40            self._session = scoped_session(sessionmaker(bind=self._engine)) 
     41             
    4142  
    4243    def createDbSession(self): 
    4344        """ 
    44            Returns a brand new Session 
     45           Returns a brand new connection to the DB.         
     46           @return: a sqlalchemy.orm.session.Session instance if the ORM is fully configured, otherwise a sqlalchemy.engine.base.Connection instance  
    4547        """ 
    46         return self._session() 
     48        if self._session: 
     49            return self._session() 
     50        if self._engine: 
     51            return self._engine.connect() 
    4752 
    4853    def closeDbSession(self, dbSession): 
    4954        """ 
    50           Commits and closes the given session instance 
    51           :param dbSession: a Session instance 
     55          Commits and closes the given session/connection instance 
     56          :param dbSession: a Session/Connection instance 
    5257        """ 
    5358        try: 
  • mauRepo/MolesManager/trunk/src/libs/migration/tests/testconfig.py

    r8217 r8222  
    66MIGRATION_DB_CONNECTION = 'postgresql://badc:rotyn217m@neptune.badc.rl.ac.uk:5432/Moles3' 
    77MOLES3_DB_CONNECTION = 'postgresql://badc:rotyn217m@neptune.badc.rl.ac.uk:5432/Moles3' 
     8INFO_DB_CONNECTION = 'postgresql://cedainfo:ler239b@bora.badc.rl.ac.uk:5432/cedainfo' 
    89 
    910from libs.migration.db.migrationTables import doTables as doMigration 
Note: See TracChangeset for help on using the changeset viewer.