Changeset 8222
- Timestamp:
- 12/04/12 11:42:59 (9 years ago)
- 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 43 43 44 44 self.extent = [] 45 self._party = [] 45 46 self._party_ci_individual = [] 46 47 self._party_ci_organisation = [] … … 57 58 58 59 @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 66 72 73 ''' 67 74 @party.setter 68 75 def party(self, value): … … 78 85 self._party_ci_organisation.append(item) 79 86 continue 87 ''' 80 88 81 89 @property … … 86 94 def role(self, value): 87 95 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 88 108 89 109 def __key(self): -
mauRepo/MolesManager/trunk/src/libs/commons_db.py
r8147 r8222 25 25 Represents a database instance managed by an SQLAlchemy engine. 26 26 """ 27 def __init__(self, connection, script ):27 def __init__(self, connection, script = None): 28 28 """ 29 29 :param connection: the URL used to open a connection to the database … … 34 34 self._script = script 35 35 self._engine = create_engine(self._connection, echo=True) 36 if (self._script): 36 self._session = None 37 if self._script: 37 38 self._script(self._metadata) 38 #execfile(self._script, {'metadata': DbManager._metadata, 'engine': self._engine})39 39 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 41 42 42 43 def createDbSession(self): 43 44 """ 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 45 47 """ 46 return self._session() 48 if self._session: 49 return self._session() 50 if self._engine: 51 return self._engine.connect() 47 52 48 53 def closeDbSession(self, dbSession): 49 54 """ 50 Commits and closes the given session instance51 :param dbSession: a Session instance55 Commits and closes the given session/connection instance 56 :param dbSession: a Session/Connection instance 52 57 """ 53 58 try: -
mauRepo/MolesManager/trunk/src/libs/migration/tests/testconfig.py
r8217 r8222 6 6 MIGRATION_DB_CONNECTION = 'postgresql://badc:rotyn217m@neptune.badc.rl.ac.uk:5432/Moles3' 7 7 MOLES3_DB_CONNECTION = 'postgresql://badc:rotyn217m@neptune.badc.rl.ac.uk:5432/Moles3' 8 INFO_DB_CONNECTION = 'postgresql://cedainfo:ler239b@bora.badc.rl.ac.uk:5432/cedainfo' 8 9 9 10 from libs.migration.db.migrationTables import doTables as doMigration
Note: See TracChangeset
for help on using the changeset viewer.