Changeset 8489


Ignore:
Timestamp:
07/08/12 16:24:30 (7 years ago)
Author:
mnagni
Message:

Incomplete - # 22534: Add versiojn number to the gui page
 http://team.ceda.ac.uk/trac/ceda/ticket/22534
fixing some pylint issues
changing the versioning strategy

Location:
mauRepo/MolesManager/trunk
Files:
1 deleted
6 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/cedaMoles/MolesManager/moles3epb.py

    r8486 r8489  
    5454class Moles3EPBFactory(EPB): 
    5555    
    56     def __init__(self, dbManager): 
    57         self._dbManager = dbManager 
     56    def __init__(self, db_manager): 
     57        self._db_manager = db_manager 
    5858        self._initCEDA_Customization()    
    5959         
     
    6161    def _initCEDA_Customization(self): 
    6262        self._associateCEDA_GUID() 
    63         associateMOParty_indexes(self._dbManager.metadata) 
     63        associateMOParty_indexes(self._db_manager.metadata) 
    6464        self._initSearchIndexes()   
    6565         
    6666    def _associateCEDA_GUID(self): 
    67         guid_table = Table('ceda_guid', self._dbManager.metadata, \ 
     67        guid_table = Table('ceda_guid', self._db_manager.metadata, \ 
    6868                           Column('id', String, primary_key=True), \ 
    6969                           Column('ceda_observationcollection', Integer, ForeignKey('ceda_observationcollection.id')),  
     
    7171                           Column('ceda_project', Integer, ForeignKey('ceda_project.id'))) 
    7272        mapper(CedaGUID, guid_table) 
    73         self._dbManager.metadata.create_all() 
     73        self._db_manager.metadata.create_all() 
    7474 
    7575    def _initSearchIndexes(self): 
     
    7777        # We don't want sqlalchemy to know about this column so we add it externally. 
    7878        try: 
    79             self._dbManager.engine.execute("alter table md_identifier add column code_search_vector tsvector")                  
     79            self._db_manager.engine.execute("alter table md_identifier add column code_search_vector tsvector")                  
    8080 
    8181            # This indexes the tsvector column 
    8282 
    83             self._dbManager.engine.execute("create index md_identifier_code_search_index on md_identifier using gin(code_search_vector)") 
     83            self._db_manager.engine.execute("create index md_identifier_code_search_index on md_identifier using gin(code_search_vector)") 
    8484 
    8585            # This sets up the trigger that keeps the tsvector column up to date. 
    86             self._dbManager.engine.execute("create trigger md_identifier_code_search_update before update or insert on md_identifier \ 
     86            self._db_manager.engine.execute("create trigger md_identifier_code_search_update before update or insert on md_identifier \ 
    8787                for each row execute procedure tsvector_update_trigger('code_search_vector', 'pg_catalog.english', code)")                         
    88         except Exception as e: 
     88        except Exception: 
    8989            pass 
    9090 
    9191    def _getSession(self): 
    92         if self._dbManager is not None: 
    93             return self._dbManager.createDbSession()                 
     92        if self._db_manager is not None: 
     93            return self._db_manager.createDbSession()                 
    9494        return None 
    9595         
     
    151151        """ 
    152152        EPB.refresh(instance, self._session)  
    153  
    154153 
    155154    def deleteInstance(self, instance): 
  • mauRepo/MolesManager/trunk/cedaMoles/__init__.py

    r8483 r8489  
    1 __version__ = '0.2.0_SNAPSHOT' 
     1__version__ = '0.2.0' 
  • mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/commons.py

    r8486 r8489  
    789789    md_identifier = MD_Identifier() 
    790790    if code == None: 
    791         raise NoNullableElement() 
     791        raise Exception('NoNullableElement') 
    792792    md_identifier.code = code 
    793793    if authority: 
  • mauRepo/MolesManager/trunk/cedaMoles/libs/migration/processor/deployment.py

    r8486 r8489  
    3737    hasMOSameHash, getAtomDocumentHashByMO, extractTitle,\ 
    3838        createCEDA_Result,\ 
    39     createEX_GeographicBoundingBox, extractGeographicExtentInMigrationDocument, findDownloadLinksInMigrationDocument,\ 
     39    createEX_GeographicBoundingBox, extractGeographicExtentInMigrationDocument, \ 
     40    findDownloadLinksInMigrationDocument,\ 
    4041    extractContent, createCI_Citation, createCI_Date, createDate,\ 
    4142    createTM_Position, createTM_Instant, extractMolesCreationDate,\ 
     
    4344    DO_UKSSDC, createMO_Organization,\ 
    4445    createCI_Contact, createCI_Address, createCI_OnlineResource,\ 
    45     createCI_Telephone, extractMolesTemporalRange, isoDateStringToTimeDate,\ 
    46     createTM_Period, findAccessLinksInMigrationDocument,\ 
     46    createCI_Telephone, extractMolesTemporalRange,\ 
     47    findAccessLinksInMigrationDocument,\ 
    4748    findLinksInDeployment, createMD_LegalConstraints,\ 
    4849    createDQ_Element, createDQ_ConformanceResult, findUpdatedDate,\ 
     
    5152    findLinksInMigrationDocument, findSubTypeInDPT, extractMolesPublishedDate,\ 
    5253    createMD_Keywords, hasMOBeenProcessed, createMO_Individual,\ 
    53     fromDateStringToPhenomenonTime, fromPhenomenonTimeToString,\ 
     54    fromDateStringToPhenomenonTime, \ 
    5455    comparePhenomenonTimes, compareGeographicBoundingBoxes 
    5556from cedaMoles.libs.epb import EPB 
    5657from cedaMoles.libs.migration.processor.deployment_data import DeploymentDataProcessor 
    57 from cedaMoles.libs.migration.exception.exceptions import NoDataLineage,\ 
     58from cedaMoles.libs.migration.exception.exceptions import NoDataLineage, \ 
    5859    NoAssociatedAuthor, NoAssociatedDeployments,\ 
    5960    NoGeographicalExtensionException 
     
    6263import logging 
    6364from datetime import date 
    64 from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_onlinefunctioncode import CI_OnLineFunctionCode 
    65 from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_datetypecode import CI_DateTypeCode 
    66 from ea_model.iso_19115_2006_metadata_corrigendum.constraint_information.md_restrictioncode import MD_RestrictionCode 
     65from ea_model.iso_19115_2006_metadata_corrigendum.\ 
     66    citation_and_responsible_party_information.ci_onlinefunctioncode \ 
     67        import CI_OnLineFunctionCode 
     68from ea_model.iso_19115_2006_metadata_corrigendum.\ 
     69    citation_and_responsible_party_information.ci_datetypecode \ 
     70        import CI_DateTypeCode 
     71from ea_model.iso_19115_2006_metadata_corrigendum.\ 
     72    constraint_information.md_restrictioncode import MD_RestrictionCode 
    6773from copy import deepcopy 
    6874import datetime 
    6975from cedaMoles.MolesManager.ceda_guid import CedaGUID 
    70 from ea_model.iso_19115_2006_metadata_corrigendum.citation_and_responsible_party_information.ci_rolecode import CI_RoleCode 
    71 from ea_model.iso_19115_2006_metadata_corrigendum.maintenance_information.md_maintenancefrequencycode import MD_MaintenanceFrequencyCode 
    72 from ea_model.moles3_4.utilities.ceda_rolevalue import CEDA_RoleValue 
    73 from ea_model.moles3_4.observation.mo_observationpublicationstatevalue import MO_ObservationPublicationStateValue 
     76from ea_model.iso_19115_2006_metadata_corrigendum.\ 
     77    citation_and_responsible_party_information.ci_rolecode import CI_RoleCode 
     78from ea_model.iso_19115_2006_metadata_corrigendum.\ 
     79    maintenance_information.md_maintenancefrequencycode \ 
     80        import MD_MaintenanceFrequencyCode 
    7481from cedaMoles.MolesManager.codelist import MM_RoleValue,\ 
    7582    MM_ObservationPublicationStateValue, getCLValue 
    76 from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation import CEDA_Observation 
    77 from ea_model.ceda_metadatamodel.ceda_result.ceda_curationvalue import CEDA_CurationValue 
    78 from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewstatusvalue import CEDA_ReviewStatusValue 
    79 from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewfrequencyvalue import CEDA_ReviewFrequencyValue 
     83from ea_model.ceda_metadatamodel.ceda_observation.ceda_observation \ 
     84    import CEDA_Observation 
     85from ea_model.ceda_metadatamodel.ceda_result.ceda_curationvalue \ 
     86    import CEDA_CurationValue 
     87from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewstatusvalue \ 
     88    import CEDA_ReviewStatusValue 
     89from ea_model.ceda_metadatamodel.ceda_utilities.ceda_reviewfrequencyvalue \ 
     90    import CEDA_ReviewFrequencyValue 
    8091 
    8192MET_GEO_FEATURE = 'Meteorological geographical features' 
     
    91102    log.addHandler(StreamHandler()) 
    92103    log.setLevel(logging.INFO)     
    93     def __init__(self, dataEntityMigration, deploymentMigration, epbRepo): 
     104    def __init__(self, data_entity_migration, deployment_migration, epbRepo): 
    94105        ''' 
    95106            Initializes the class 
     
    98109            @param epbRepo: an instance of EPBRepo               
    99110        '''               
    100         self._dataEntityMigration = dataEntityMigration 
    101         self._deploymentMigration = deploymentMigration 
     111        self._data_entity_migration = data_entity_migration 
     112        self._deployment_migration = deployment_migration 
    102113        self.epbRepo = epbRepo 
    103         self._dataEntityHasSameHash = hasMOSameHash(self._dataEntityMigration) 
    104         self._deploymentHasSameHash = hasMOSameHash(self._deploymentMigration) 
    105         self._deploymentHasBeenProcessed = hasMOBeenProcessed(self._deploymentMigration) 
     114        self._dataEntityHasSameHash = hasMOSameHash(self._data_entity_migration) 
     115        self._deploymentHasSameHash = hasMOSameHash(self._deployment_migration) 
     116        self._deploymentHasBeenProcessed = hasMOBeenProcessed(self._deployment_migration) 
    106117        self._report = [] 
    107118 
     
    128139        try: 
    129140            if tmp_auth['author'] == 'unknown': 
    130                 doc_authors = findAuthorsInResource(self._dataEntityMigration) 
     141                doc_authors = findAuthorsInResource(self._data_entity_migration) 
    131142                tmp_auth = authors[doc_authors['authors']] 
    132143             
     
    143154            for item in tmp_auth['co_author_type']:            
    144155                if (tmp_auth['co_author'][tmp_auth['co_author_type'].index(item)] == 'unknown'): 
    145                     doc_authors = findAuthorsInResource(self._dataEntityMigration) 
     156                    doc_authors = findAuthorsInResource(self._data_entity_migration) 
    146157                    tmp_auth = authors[doc_authors['contributors']] 
    147158                    break 
     
    163174        
    164175    def updateObservation(self): 
    165         return EPB.searchOrCreate(CEDA_Observation, self._deploymentMigration.ceda_observation_id) 
     176        return EPB.searchOrCreate(CEDA_Observation, self._deployment_migration.ceda_observation_id) 
    166177 
    167178    def assignDOI(self, observation, doi): 
     
    201212            return 
    202213         
    203         provider_id = extractMolesProviderID(self._deploymentMigration) 
     214        provider_id = extractMolesProviderID(self._deployment_migration) 
    204215        i_keywords = [] 
    205216        if provider_id == DO_BADC: 
     
    218229            return 
    219230         
    220         data_lineage = findMolesLineage(self._dataEntityMigration) 
     231        data_lineage = findMolesLineage(self._data_entity_migration) 
    221232        if data_lineage is None: 
    222             raise NoDataLineage(self._dataEntityMigration) 
     233            raise NoDataLineage(self._data_entity_migration) 
    223234         
    224235        if data_lineage != observation.dataLineage: 
     
    230241 
    231242        i_sources = []                 
    232         download = findDownloadLinksInMigrationDocument(self._deploymentMigration) 
     243        download = findDownloadLinksInMigrationDocument(self._deployment_migration) 
    233244        content = None 
    234245        if len(download) == 0: 
    235             download = findDownloadLinksInMigrationDocument(self._dataEntityMigration) 
    236             content = extractContent(self._dataEntityMigration) 
     246            download = findDownloadLinksInMigrationDocument(self._data_entity_migration) 
     247            content = extractContent(self._data_entity_migration) 
    237248        else: 
    238             content = extractContent(self._deploymentMigration) 
     249            content = extractContent(self._deployment_migration) 
    239250        for dwn in download: 
    240251            int_description = None 
     
    249260                                                   description = int_description, applicationProfile = int_applicationProfile)) 
    250261             
    251         dataentity_id = '%s__ATOM__%s' % (self._dataEntityMigration.doc_owner, self._dataEntityMigration.doc_name) 
     262        dataentity_id = '%s__ATOM__%s' % (self._data_entity_migration.doc_owner, self._data_entity_migration.doc_name) 
    252263        dataentity_id = dataentity_id.replace('.atom', '')            
    253264        infodb_de = self.epbRepo.infodbEPB.getCedaInfoApp_dataentityByDE_ID(dataentity_id) 
     
    279290            return 
    280291            
    281         provider_id = extractMolesProviderID(self._deploymentMigration) 
     292        provider_id = extractMolesProviderID(self._deployment_migration) 
    282293        party = None 
    283294        if provider_id == DO_BADC: 
     
    322333            return 
    323334                 
    324         doc_quality = extractQuality(self._dataEntityMigration) 
    325         doc_date = findUpdatedDate(self._dataEntityMigration) 
     335        doc_quality = extractQuality(self._data_entity_migration) 
     336        doc_date = findUpdatedDate(self._data_entity_migration) 
    326337        ci_dates = []             
    327338        if doc_date: 
     
    345356            return 
    346357         
    347         description = extractSummary(self._deploymentMigration) 
     358        description = extractSummary(self._deployment_migration) 
    348359        if description is None: 
    349             description = extractSummary(self._dataEntityMigration) 
     360            description = extractSummary(self._data_entity_migration) 
    350361             
    351362        if description: 
     
    356367            return 
    357368                      
    358         doc_title = extractTitle(self._deploymentMigration) 
     369        doc_title = extractTitle(self._deployment_migration) 
    359370        if doc_title is None: 
    360             doc_title = extractTitle(self._dataEntityMigration) 
     371            doc_title = extractTitle(self._data_entity_migration) 
    361372         
    362373        if doc_title.startswith('deployment_') or doc_title.startswith('Deployment_'): 
    363             links = findLinksInMigrationDocument(self._deploymentMigration) 
     374            links = findLinksInMigrationDocument(self._deployment_migration) 
    364375            dptList = links['DPT'] 
    365376            if links.has_key('DPT'): 
     
    371382                        doc_title += ' and ' + dptList[-1] 
    372383                                                         
    373             links = findLinksInDeployment(self._deploymentMigration) 
     384            links = findLinksInDeployment(self._deployment_migration) 
    374385            if links.has_key('OBS'): 
    375386                obsList = [] 
    376387                for obs in links['OBS']: 
    377                     observationStation = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, obs + '.atom') 
     388                    observationStation = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deployment_migration, obs + '.atom') 
    378389                    obsList.append((extractTitle(observationStation), findSubTypeInDPT(observationStation))) 
    379390                 
     
    391402            if links.has_key('ACTIVITY'):              
    392403                for link in links['ACTIVITY']: 
    393                     activity = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deploymentMigration, link + '.atom')                     
     404                    activity = self.epbRepo.migrationEPB.getDeploymentDataMigrationByName(self._deployment_migration, link + '.atom')                     
    394405      
    395406                    projSubType = findSubTypeInDPT(activity) 
     
    414425            return   
    415426         
    416         ge = extractGeographicExtentInMigrationDocument(self._deploymentMigration)         
     427        ge = extractGeographicExtentInMigrationDocument(self._deployment_migration)         
    417428        if ge is None: 
    418             ge = extractGeographicExtentInMigrationDocument(self._dataEntityMigration) 
     429            ge = extractGeographicExtentInMigrationDocument(self._data_entity_migration) 
    419430         
    420431        if ge is None: 
    421             self._report.append(NoGeographicalExtensionException(self._deploymentMigration)) 
    422             self._report.append(NoGeographicalExtensionException(self._dataEntityMigration)) 
     432            self._report.append(NoGeographicalExtensionException(self._deployment_migration)) 
     433            self._report.append(NoGeographicalExtensionException(self._data_entity_migration)) 
    423434         
    424435        geographicExtent = createEX_GeographicBoundingBox(ge['east'], ge['north'], ge['west'], ge['south']) 
     
    434445            return   
    435446         
    436         creation_date = extractMolesPublishedDate(self._deploymentMigration) 
     447        creation_date = extractMolesPublishedDate(self._deployment_migration) 
    437448        if creation_date is None: 
    438             creation_date = extractMolesCreationDate(self._deploymentMigration) 
     449            creation_date = extractMolesCreationDate(self._deployment_migration) 
    439450        py_datetime = isoDateTimeStringToTimeDate(creation_date) 
    440451        date_time = createDateTime(py_datetime)     
     
    450461            return   
    451462               
    452         doc_phenomenon_time = extractMolesTemporalRange(self._deploymentMigration)  
     463        doc_phenomenon_time = extractMolesTemporalRange(self._deployment_migration)  
    453464        pt = fromDateStringToPhenomenonTime(doc_phenomenon_time)     
    454465         
     
    461472            return  
    462473         
    463         access_link = findAccessLinksInMigrationDocument(self._deploymentMigration) 
    464         dwn_link = findDownloadLinksInMigrationDocument(self._deploymentMigration) 
     474        access_link = findAccessLinksInMigrationDocument(self._deployment_migration) 
     475        dwn_link = findDownloadLinksInMigrationDocument(self._deployment_migration) 
    465476        if len(access_link) == 0: 
    466             access_link = findAccessLinksInMigrationDocument(self._dataEntityMigration)  
     477            access_link = findAccessLinksInMigrationDocument(self._data_entity_migration)  
    467478 
    468479        i_accessConstraints = [] 
     
    472483        if len(access_link) == 0: 
    473484            if len(dwn_link) == 0: 
    474                 dwn_link = findDownloadLinksInMigrationDocument(self._dataEntityMigration) 
     485                dwn_link = findDownloadLinksInMigrationDocument(self._data_entity_migration) 
    475486                if dwn_link and len(dwn_link) == 1:                 
    476487                    i_use_limitation.append("These data are open access and available through %s." % (dwn_link[0]['href']) ) 
     
    488499                                     
    489500        '''                                 
    490         contentDict = extractContent(self._deploymentMigration) 
     501        contentDict = extractContent(self._deployment_migration) 
    491502        if not contentDict.has_key('access-restricted'): 
    492             contentDict = extractContent(self._dataEntityMigration) 
     503            contentDict = extractContent(self._data_entity_migration) 
    493504        '''             
    494505 
     
    497508            return  
    498509                 
    499         i_code = 'http://badc.nerc.ac.uk/view/%s__ATOM__%s' % (self._deploymentMigration.doc_owner, self._deploymentMigration.doc_name) 
     510        i_code = 'http://badc.nerc.ac.uk/view/%s__ATOM__%s' % (self._deployment_migration.doc_owner, self._deployment_migration.doc_name) 
    500511        i_code = i_code.replace('.atom', '') 
    501         #i_code = buildExistDocPath(self._deploymentMigration.doc_status, DT_DEPLOYMENTS, self._deploymentMigration.doc_owner, self._deploymentMigration.doc_name) 
     512        #i_code = buildExistDocPath(self._deployment_migration.doc_status, DT_DEPLOYMENTS, self._deployment_migration.doc_owner, self._deployment_migration.doc_name) 
    502513        i_authority = createCI_Citation('moles2url') 
    503514        identifier = createMD_Identifier(code = i_code, authority = i_authority) 
     
    529540            return                       
    530541 
    531             updateFrequency = extractUpdateFrequency(self._dataEntityMigration) 
     542            updateFrequency = extractUpdateFrequency(self._data_entity_migration) 
    532543            if updateFrequency: 
    533544                resultAccumulation = MD_MaintenanceFrequencyCode.from_string(updateFrequency) 
     
    545556            return  
    546557         
    547         whereAreAuthors = self._deploymentMigration         
    548         doc_authors = findAuthorsInResource(self._deploymentMigration)         
     558        whereAreAuthors = self._deployment_migration         
     559        doc_authors = findAuthorsInResource(self._deployment_migration)         
    549560        if doc_authors['authors'] in [DO_BADC, DO_NEODC]: 
    550             doc_authors = findAuthorsInResource(self._dataEntityMigration) 
    551             whereAreAuthors = self._dataEntityMigration  
     561            doc_authors = findAuthorsInResource(self._data_entity_migration) 
     562            whereAreAuthors = self._data_entity_migration  
    552563                 
    553564        ind_names = [] 
     
    618629         
    619630        #Is a first time process? 
    620         if not hasMOBeenProcessed(self._deploymentMigration): 
     631        if not hasMOBeenProcessed(self._deployment_migration): 
    621632            ceda_observation.publicationState = getCLValue(MM_ObservationPublicationStateValue.cl_working)           
    622             docHash = getAtomDocumentHashByMO(self._dataEntityMigration) 
     633            docHash = getAtomDocumentHashByMO(self._data_entity_migration) 
    623634            self.epbRepo.moles3EPB.persistInstance(ceda_observation)         
    624             self.epbRepo.migrationEPB.updateMigrationObject(self._deploymentMigration, \ 
     635            self.epbRepo.migrationEPB.updateMigrationObject(self._deployment_migration, \ 
    625636                {'ceda_observation_id': ceda_observation.id, 
    626637                 'doc_hash': docHash})                 
     
    629640        if self.epbRepo.moles3EPB.retrieveGUIDFromInstance(ceda_observation) is None:        
    630641            ceda_guid = CedaGUID() 
    631             ceda_guid.id = calculateHash(self._deploymentMigration.depl_id) 
     642            ceda_guid.id = calculateHash(self._deployment_migration.depl_id) 
    632643            ceda_guid.ceda_observation = ceda_observation.id 
    633644            self.epbRepo.moles3EPB.persistInstance(ceda_guid) 
     
    635646 
    636647        if not self._deploymentHasBeenProcessed:                 
    637             deploymentDataProcessor = DeploymentDataProcessor(self._deploymentMigration, self.epbRepo)                 
     648            deploymentDataProcessor = DeploymentDataProcessor(self._deployment_migration, self.epbRepo)                 
    638649            procedure = deploymentDataProcessor.createProcess() 
    639650            project = deploymentDataProcessor.createProject()  
     
    650661        ceda_observation = None 
    651662        #Moles3 object exists...  
    652         if self._deploymentMigration.ceda_observation_id: 
    653             ceda_observation = self.epbRepo.moles3EPB.search(CEDA_Observation, self._deploymentMigration.ceda_observation_id) 
     663        if self._deployment_migration.ceda_observation_id: 
     664            ceda_observation = self.epbRepo.moles3EPB.search(CEDA_Observation, self._deployment_migration.ceda_observation_id) 
    654665        else: 
    655666            #... does not exist so create it 
  • mauRepo/MolesManager/trunk/cedaMoles/tests/migration/moles3epbtests.py

    r8488 r8489  
    44@author: mnagni 
    55''' 
    6 import unittest 
    76import logging, datetime 
    8 from logging import StreamHandler 
    9 from sqlalchemy.exc import IntegrityError 
    107from cedaMoles.libs.migration.processor.commons import createCI_Date, createDateTime,\ 
    118    createDate, createTM_Position, createTM_Instant 
     
    1613from test_utils import createObservationCollection,\ 
    1714    createProject   
    18 from cedaMoles.tests.testconfig import EVENTS_DB 
    1915from ea_model.ceda_metadatamodel.ceda_observationcollection.ceda_observationcollection import CEDA_ObservationCollection 
    2016from cedaMoles.tests.cedamolestest import CedaMolesTest 
     
    2420 
    2521class Moles3EPBTest(CedaMolesTest): 
     22 
     23    log = logging.getLogger('Moles3EPBTest') 
    2624 
    2725    def runTest(self): 
     
    3836        observationCollection = createObservationCollection() 
    3937         
    40         self.logging.info('Stores an empty new CEDA_ObservationCollection') 
     38        Moles3EPBTest.log.info('Stores an empty new CEDA_ObservationCollection') 
    4139        self.epbRepo.moles3EPB.persistInstance(observationCollection) 
    4240         
    43         self.logging.info('Tries to retrieve it') 
     41        Moles3EPBTest.log.info('Tries to retrieve it') 
    4442        self.assertTrue(hasattr(observationCollection, 'id'), "Cannot create  ObservationCollection")         
    4543        res = self.epbRepo.moles3EPB.search(CEDA_ObservationCollection, observationCollection.id) 
    4644        self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 
    4745         
    48         self.logging.info('Deletes it') 
     46        Moles3EPBTest.log.info('Deletes it') 
    4947        self.epbRepo.moles3EPB.delete(observationCollection)         
    5048         
     
    5250        observation = CEDA_Observation() 
    5351         
    54         self.logging.info('Tries to stores an empty new %s' % (observation.__class__.__name__)) 
     52        Moles3EPBTest.log.info('Tries to stores an empty new %s' % (observation.__class__.__name__)) 
    5553        self.epbRepo.moles3EPB.persistInstance(observation) 
    5654        #self.assertRaises(IntegrityError, session.commit) 
    57         self.logging.info('Catches that Ceda_Observation.dataLineage is missing') 
    58          
    59         self.logging.info('Adds the dataLineage and tries to store it again') 
     55        Moles3EPBTest.log.info('Catches that Ceda_Observation.dataLineage is missing') 
     56         
     57        Moles3EPBTest.log.info('Adds the dataLineage and tries to store it again') 
    6058        observation.dataLineage = "aNewDataLineage"         
    6159        self.epbRepo.moles3EPB.persistInstance(observation)                 
    6260         
    63         self.logging.info('Tries to retrieve it') 
     61        Moles3EPBTest.log.info('Tries to retrieve it') 
    6462        self.assertTrue(hasattr(observation, 'id'), 'Cannot create %s' % (observation.__class__.__name__))         
    6563        res = self.epbRepo.moles3EPB.search(CEDA_Observation, observation.id) 
    6664        self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 
    6765         
    68         self.logging.info('Deletes it') 
     66        Moles3EPBTest.log.info('Deletes it') 
    6967        self.epbRepo.moles3EPB.delete(observation) 
    7068 
     
    7270        observationCollection = createObservationCollection() 
    7371         
    74         self.logging.info('Stores an empty new CEDA_ObservationCollection') 
     72        Moles3EPBTest.log.info('Stores an empty new CEDA_ObservationCollection') 
    7573        self.epbRepo.moles3EPB.persistInstance(observationCollection) 
    7674         
    77         self.logging.info('Tries to retrieve it') 
     75        Moles3EPBTest.log.info('Tries to retrieve it') 
    7876        self.assertTrue(hasattr(observationCollection, 'id'), "Cannot create  ObservationCollection")         
    7977        res = self.epbRepo.moles3EPB.search(CEDA_ObservationCollection, observationCollection.id) 
    8078        self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 
    8179         
    82         self.logging.info('Adds two CEDA_Observations') 
     80        Moles3EPBTest.log.info('Adds two CEDA_Observations') 
    8381        firstObservation = self._createObservation() 
    8482        observationCollection.member.append(firstObservation) 
     
    8886        self.assertTrue(self.epbRepo.moles3EPB.observationCollectionHasObservation(observationCollection.id, firstObservation.id), "The collection should contains the given observation") 
    8987         
    90         self.logging.info('Deletes it') 
     88        Moles3EPBTest.log.info('Deletes it') 
    9189        self.epbRepo.moles3EPB.delete(observationCollection) 
    9290 
     
    9492        observation = self._createObservation() 
    9593         
    96         self.logging.info('Tries to stores a new %s' % (observation.__class__.__name__)) 
     94        Moles3EPBTest.log.info('Tries to stores a new %s' % (observation.__class__.__name__)) 
    9795        self.epbRepo.moles3EPB.persistInstance(observation)                 
    9896         
    99         self.logging.info('Tries to retrieve it') 
     97        Moles3EPBTest.log.info('Tries to retrieve it') 
    10098        self.assertTrue(hasattr(observation, 'id'), 'Cannot create %s' % (observation.__class__.__name__))         
    10199        res = self.epbRepo.moles3EPB.search(CEDA_Observation, observation.id) 
    102100        self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 
    103101         
    104         self.logging.info('Deletes it') 
     102        Moles3EPBTest.log.info('Deletes it') 
    105103        self.epbRepo.moles3EPB.delete(observation) 
    106104 
     
    111109        ci_date = createCI_Date(CI_DateTypeCode.cl_creation, dt) 
    112110         
    113         self.logging.info('Stores an empty new CEDA_ObservationCollection') 
     111        Moles3EPBTest.log.info('Stores an empty new CEDA_ObservationCollection') 
    114112        self.epbRepo.moles3EPB.persistInstance(ci_date) 
    115113         
    116         self.logging.info('Tries to retrieve it') 
     114        Moles3EPBTest.log.info('Tries to retrieve it') 
    117115        self.assertTrue(hasattr(ci_date, 'id'), "Cannot create  CI_Date")         
    118116        res = self.epbRepo.moles3EPB.search(CI_Date, ci_date.id) 
    119117        self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 
    120118         
    121         self.logging.info('Deletes it') 
     119        Moles3EPBTest.log.info('Deletes it') 
    122120        self.epbRepo.moles3EPB.delete(ci_date) 
    123121 
     
    125123        tm_position = self._createTM_Position() 
    126124         
    127         self.logging.info('Stores an empty new TM_Position') 
     125        Moles3EPBTest.log.info('Stores an empty new TM_Position') 
    128126        self.epbRepo.moles3EPB.persistInstance(tm_position) 
    129127         
    130         self.logging.info('Tries to retrieve it') 
     128        Moles3EPBTest.log.info('Tries to retrieve it') 
    131129        self.assertTrue(hasattr(tm_position, 'id'), "Cannot create  TM_Position")         
    132130        res = self.epbRepo.moles3EPB.search(TM_Position, tm_position.id) 
    133131        self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 
    134132         
    135         self.logging.info('Deletes it') 
     133        Moles3EPBTest.log.info('Deletes it') 
    136134        self.epbRepo.moles3EPB.delete(tm_position)         
    137135 
     
    140138        tm_instant = self._createTM_Instant() 
    141139 
    142         self.logging.info('Stores an empty new TM_Instant') 
     140        Moles3EPBTest.log.info('Stores an empty new TM_Instant') 
    143141        self.epbRepo.moles3EPB.persistInstance(tm_instant) 
    144142         
    145         self.logging.info('Tries to retrieve it') 
     143        Moles3EPBTest.log.info('Tries to retrieve it') 
    146144        self.assertTrue(hasattr(tm_instant, 'id'), "Cannot create  TM_Instant")         
    147145        res = self.epbRepo.moles3EPB.search(TM_Instant, tm_instant.id) 
    148146        self.assertNotEqual(res, None, "Cannot retrieve the stored instance") 
    149147         
    150         self.logging.info('Deletes it') 
     148        Moles3EPBTest.log.info('Deletes it') 
    151149        self.epbRepo.moles3EPB.delete(tm_instant) 
    152150 
     
    154152        project = createProject() 
    155153     
    156         self.logging.info('Stores an empty new CEDA_Project') 
     154        Moles3EPBTest.log.info('Stores an empty new CEDA_Project') 
    157155        self.epbRepo.moles3EPB.persistInstance(project) 
    158156         
    159         self.logging.info('Tries to retrieve it') 
     157        Moles3EPBTest.log.info('Tries to retrieve it') 
    160158        self.assertTrue(hasattr(project, 'id'), "Cannot create  TM_Instant")         
    161159        res = self.epbRepo.moles3EPB.search(CEDA_Project, project.id) 
     
    163161            self.assertTrue(item.abstract == 'test_abstract', "Cannot retrieve the abstract from stored project") 
    164162         
    165         self.logging.info('Deletes it') 
     163        Moles3EPBTest.log.info('Deletes it') 
    166164        self.epbRepo.moles3EPB.delete(project) 
    167165     
     
    169167    def checkCI_Responsibility(self):         
    170168        responsibility = createCI_Responsibility() 
    171         self.logging.info('Stores an empty new CEDA_Project') 
     169        Moles3EPBTest.log.info('Stores an empty new CEDA_Project') 
    172170        self.epbRepo.moles3EPB.persistInstance(responsibility) 
    173171        self.epbRepo.moles3EPB.expunge(responsibility) 
  • mauRepo/MolesManager/trunk/setup.py

    r8488 r8489  
    88VERSION = re.compile(r".*__version__ = '(.*?)'", 
    99                     re.S).match(v_file.read()).group(1) 
    10 if VERSION.endswith('SNAPSHOT'): 
    11     VERSION = VERSION + '_' +str(int(time.time())) 
     10 
     11if os.environ.has_key('SVN_REVISION'): 
     12    VERSION = VERSION + '_' + os.environ['SVN_REVISION'] 
     13 
    1214setup( 
    1315    name='cedaMoles', 
Note: See TracChangeset for help on using the changeset viewer.