Changeset 8537
- Timestamp:
- 17/08/12 13:50:30 (8 years ago)
- Location:
- mauRepo/MolesManager/trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
mauRepo/MolesManager/trunk/cedaMoles/MolesManager/__init__.py
r8536 r8537 16 16 return 'http://%s/%s/' % (request.get_host(), root_url) 17 17 18 return 'http://%s/' % (request.get_host())18 return 'http://%s/' % request.get_host() -
mauRepo/MolesManager/trunk/cedaMoles/MolesManager/moles3epb.py
r8522 r8537 71 71 guid_table = Table('ceda_guid', self._db_manager.metadata, \ 72 72 Column('id', String, primary_key=True), \ 73 Column('ceda_observationcollection', Integer, ForeignKey('ceda_observationcollection.id')), 74 Column('ceda_observation', Integer, ForeignKey('ceda_observation.id')), 75 Column('ceda_project', Integer, ForeignKey('ceda_project.id'))) 73 Column('ceda_observationcollection', \ 74 Integer, ForeignKey('ceda_observationcollection.id')), 75 Column('ceda_observation', \ 76 Integer, ForeignKey('ceda_observation.id')), 77 Column('ceda_project', \ 78 Integer, ForeignKey('ceda_project.id'))) 76 79 mapper(CedaGUID, guid_table) 77 80 self._db_manager.metadata.create_all() … … 81 84 # We don't want sqlalchemy to know about this column so we add it externally. 82 85 try: 83 self._db_manager.engine.execute("alter table md_identifier add column code_search_vector tsvector") 86 self._db_manager.engine.execute("alter table md_identifier \ 87 add column code_search_vector tsvector") 84 88 85 89 # This indexes the tsvector column 86 90 87 self._db_manager.engine.execute("create index md_identifier_code_search_index on md_identifier using gin(code_search_vector)") 91 self._db_manager.engine.execute("create index \ 92 md_identifier_code_search_index on md_identifier using gin(code_search_vector)") 88 93 89 94 # This sets up the trigger that keeps the tsvector column up to date. 90 self._db_manager.engine.execute("create trigger md_identifier_code_search_update before update or insert on md_identifier \ 91 for each row execute procedure tsvector_update_trigger('code_search_vector', 'pg_catalog.english', code)") 95 self._db_manager.engine.execute("create trigger \ 96 md_identifier_code_search_update \ 97 before update or insert on md_identifier \ 98 for each row execute procedure \ 99 tsvector_update_trigger('code_search_vector', \ 100 'pg_catalog.english', code)") 92 101 except Exception: 93 102 pass -
mauRepo/MolesManager/trunk/cedaMoles/MolesManager/views/moles2gui/__init__.py
r8517 r8537 364 364 return adapter 365 365 366 def unicode ToString(text):366 def unicode_to_string(text): 367 367 if isinstance(text, unicode): 368 368 return str(text) -
mauRepo/MolesManager/trunk/cedaMoles/MolesManager/views/moles2gui/om/period.py
r8486 r8537 31 31 @author: mnagni 32 32 ''' 33 from cedaMoles.MolesManager.views.moles2gui import CedaMolesGuiAdapter, unicode ToString33 from cedaMoles.MolesManager.views.moles2gui import CedaMolesGuiAdapter, unicode_to_string 34 34 from ea_model.iso_19108_2006_temporal_schema.temporal_objects.tm_period import TM_Period 35 35 … … 71 71 72 72 def _parseDate(self, dateString): 73 d, t = unicode ToString(dateString).split()73 d, t = unicode_to_string(dateString).split() 74 74 year, month, day = d.split("-") 75 75 hour, minute, second = t.split(":") -
mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/dataEntity.py
r8522 r8537 260 260 261 261 def process(self): 262 obs Coll = None262 obs_coll = None 263 263 DataEntityProcessor.log.info("Processing dataEntity: %s" \ 264 264 % (migrationObjectDescription(self._dataEntityMigration))) 265 265 try : 266 266 if self._dataEntityMigration.ceda_observation_coll_id: 267 #obs Coll = self.epbRepo.moles3EPB.search(CEDA_ObservationCollection, self._dataEntityMigration.ceda_observation_coll_id)268 obs Coll = self.epbRepo.moles3EPB.searchSelectiveLoad(CEDA_ObservationCollection, self._dataEntityMigration.ceda_observation_coll_id, \267 #obs_coll = self.epbRepo.moles3EPB.search(CEDA_ObservationCollection, self._dataEntityMigration.ceda_observation_coll_id) 268 obs_coll = self.epbRepo.moles3EPB.searchSelectiveLoad(CEDA_ObservationCollection, self._dataEntityMigration.ceda_observation_coll_id, \ 269 269 ['identifier']) 270 270 else: 271 obs Coll = CEDA_ObservationCollection()272 self._execute(obs Coll)271 obs_coll = CEDA_ObservationCollection() 272 self._execute(obs_coll) 273 273 except Exception as ex: 274 274 self._report.append(ex) … … 276 276 277 277 #retrieves the associated deployment links from the data_entity 278 deployments Links = find_deployments_in_de(self._dataEntityMigration)278 deployments_links = find_deployments_in_de(self._dataEntityMigration) 279 279 #retrieves the DataEntityMigration sorted by creation date 280 deploymentMigrations = self.epbRepo.migrationEPB.getAllDeploymentsMigrationByDataEntitySortedByDate( \ 281 self._dataEntityMigration, deploymentsLinks) 280 deployment_migrations = self.epbRepo.migrationEPB.\ 281 getAllDeploymentsMigrationByDataEntitySortedByDate(self._dataEntityMigration, \ 282 deployments_links) 282 283 283 if deployment Migrations is None or len(deploymentMigrations) == 0:284 if deployment_migrations is None or len(deployment_migrations) == 0: 284 285 self._report.append(NoAssociatedDeployments(self._dataEntityMigration)) 285 286 return self._report 286 287 287 howManydm = len(deployment Migrations)288 for deployment Migration in deploymentMigrations:288 howManydm = len(deployment_migrations) 289 for deployment_migration in deployment_migrations: 289 290 try: 290 ceda_observation = self._processDeploymentMigration(deploymentMigration, \ 291 howManydm == 1) 291 ceda_observation \ 292 = self._processDeploymentMigration(deployment_migration, \ 293 howManydm == 1) 292 294 #Is a first time process? 293 if not self.epbRepo.moles3EPB.observationCollectionHasObservation(getattr(obsColl, 'id'), getattr(ceda_observation, 'id')): 294 self.epbRepo.moles3EPB.updateCedaObject(obsColl, \ 295 if not self.epbRepo.moles3EPB.\ 296 observationCollectionHasObservation(getattr(obs_coll, 'id'), \ 297 getattr(ceda_observation, 'id')): 298 self.epbRepo.moles3EPB.updateCedaObject(obs_coll, \ 295 299 {'member': ceda_observation}) 296 300 297 self._assignObservationCollectionToProject(obs Coll, ceda_observation)301 self._assignObservationCollectionToProject(obs_coll, ceda_observation) 298 302 except Exception as ex: 299 303 self._report.append(ex) 300 304 301 self._assignGeographicExtent(obs Coll)302 self._assignPhenomenonTime(obs Coll)305 self._assignGeographicExtent(obs_coll) 306 self._assignPhenomenonTime(obs_coll) 303 307 304 308 return self._report -
mauRepo/MolesManager/trunk/cedaMoles/tests/migration/migrationprocess.py
r8522 r8537 51 51 52 52 def setUp(self): 53 migrationDB = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT, sql_echo=True) 54 molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, sql_echo=True, session_event_manager=EVENTS_DB) 55 infoDB = DbManager(INFO_DB_CONNECTION) 53 migration_db = DbManager(MIGRATION_DB_CONNECTION, MIGRATION_DB_SCRIPT, 54 sql_echo=True) 55 moles_db = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, 56 sql_echo=True, session_event_manager=EVENTS_DB) 57 info_db = DbManager(INFO_DB_CONNECTION) 56 58 57 infoFactory = InfodbEPBFactory(info DB)58 moles3Factory = Moles3EPBFactory(moles DB)59 migrationFactory = MigrationEPBFactory(migration DB)59 infoFactory = InfodbEPBFactory(info_db) 60 moles3Factory = Moles3EPBFactory(moles_db) 61 migrationFactory = MigrationEPBFactory(migration_db) 60 62 61 63 self.epbRepo = EPBRepo(moles3Factory.createEPB() , \ -
mauRepo/MolesManager/trunk/cedaMoles/tests/moles2gui/om/period.py
r8496 r8537 33 33 import unittest 34 34 from json import loads, dumps 35 from cedaMoles.MolesManager.views.moles2gui import encodeCedaMoles2Json, \35 from cedaMoles.MolesManager.views.moles2gui import encodeCedaMoles2Json, \ 36 36 decodeJson2CedaMoles, getData 37 37 from cedaMoles.libs.migration.processor.commons import from_date_string_to_pt … … 42 42 43 43 def setUp(self): 44 #molesDB = DbManager(MOLES3_DB_CONNECTION, MOLES3_DB_SCRIPT, sql_echo=True, session_event_manager=EVENTS_DB)45 #moles3Factory = Moles3EPBFactory(molesDB)46 #self.epbRepo = EPBRepo(moles3Factory.createEPB(), None, None)47 44 pass 48 45 … … 57 54 json = encodeCedaMoles2Json(period) 58 55 #----------------------- test ------------------------ 59 dec Json = loads(json)60 self.assertEqual(dec Json['startDate'], '2002-07-22 00:00:00', "Error")56 dec_json = loads(json) 57 self.assertEqual(dec_json['startDate'], '2002-07-22 00:00:00', "Error") 61 58 #----------------------------------------------------- 62 59 63 60 #----------------------- test ------------------------ 64 61 new_period = decodeJson2CedaMoles(json = json, cedaMoleObj = period) 65 self.assertTrue(getData(new_period, 'begin.position.date8601.year') in decJson['startDate'], "decodeJson2CedaMoles Error") 62 self.assertTrue(getData(new_period, 'begin.position.date8601.year') 63 in dec_json['startDate'], 64 "decodeJson2CedaMoles Error") 66 65 #----------------------------------------------------- 67 66 … … 72 71 period = from_date_string_to_pt('2002-07-22/2011-08-06') 73 72 json = encodeCedaMoles2Json(period) 74 dec Json = loads(json)75 dec Json['startDate'] = '1980-07-22 00:00:00'76 new_json = dumps(dec Json)73 dec_json = loads(json) 74 dec_json['startDate'] = '1980-07-22 00:00:00' 75 new_json = dumps(dec_json) 77 76 #----------------------- test ---------------------------- 78 77 # Update party.name and test decoding 79 78 new_instant = decodeJson2CedaMoles(json = new_json, cedaMoleObj = period) 80 self.assertEqual('1980', getData(new_instant, 'begin.position.date8601.year'), "Error") 79 self.assertEqual('1980', 80 getData(new_instant, 'begin.position.date8601.year'), 81 "Error") 81 82 #--------------------------------------------------------- -
mauRepo/MolesManager/trunk/docs/source/conf.py
r8476 r8537 31 31 # Add any Sphinx extension module names here, as strings. They can be extensions 32 32 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. 33 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', 'sphinx.ext.coverage'] 33 extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo', \ 34 'sphinx.ext.coverage'] 34 35 35 36 # Add any paths that contain templates here, relative to this directory.
Note: See TracChangeset
for help on using the changeset viewer.