Ignore:
Timestamp:
09/09/08 16:09:10 (12 years ago)
Author:
cbyrom
Message:

Move module level constants to become class level constants; NB, the former
seem to only be visible to other modules in the same package.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/ndgObject.py

    r4183 r4187  
    11import ndgRetrieve, xmlHandler2, logging 
    2  
    3 # The various different document types: 
    4 MOLES_DOC_TYPE = 'NDG-B0' 
    5 DIF_DOC_TYPE = 'DIF' 
    6 DC_DOC_TYPE = 'DC' 
    7 ISO_DOC_TYPE = 'ISO19139' 
    8 NDGB1_DOC_TYPE = 'NDG-B1' 
    9 NDGB0_DOC_TYPE = 'NDG-B0' 
    10 MDIP_DOC_TYPE = 'MDIP' 
    11 NDGA0_DOC_TYPE = 'NDG-A0' 
    12 NUMSIM_DOC_TYPE = 'NumSim' 
    13 ATOM_DOC_TYPE = 'ATOM' 
    14 ATOM_BACKUP_DOC_TYPE = 'ATOM-BACKUP' 
    15      
    16 # Group the doc types according to the source they should be retrieved from 
    17 DISCOVERY_SCHEMES = ['DIF','DC','MDIP','ISO19139', 'ISO'] 
    18 BROWSE_SCHEMES = ['NDG-B0','NDG-B1','NumSim', 'ATOM', 'ATOM-BACKUP'] 
    192 
    203class ndgObject: 
     
    247                (2) a printable xml representation ''' 
    258     
     9    # The various different document types: 
     10    MOLES_DOC_TYPE = 'NDG-B0' 
     11    DIF_DOC_TYPE = 'DIF' 
     12    DC_DOC_TYPE = 'DC' 
     13    ISO_DOC_TYPE = 'ISO19139' 
     14    NDGB1_DOC_TYPE = 'NDG-B1' 
     15    NDGB0_DOC_TYPE = 'NDG-B0' 
     16    MDIP_DOC_TYPE = 'MDIP' 
     17    NDGA0_DOC_TYPE = 'NDG-A0' 
     18    NUMSIM_DOC_TYPE = 'NumSim' 
     19    ATOM_DOC_TYPE = 'ATOM' 
     20    ATOM_BACKUP_DOC_TYPE = 'ATOM-BACKUP' 
     21         
     22    # Group the doc types according to the source they should be retrieved from 
     23    DISCOVERY_SCHEMES = [DIF_DOC_TYPE, DC_DOC_TYPE, \ 
     24                         MDIP_DOC_TYPE, ISO_DOC_TYPE, 'ISO'] 
     25    BROWSE_SCHEMES = [MOLES_DOC_TYPE, NDGB1_DOC_TYPE, \ 
     26                      NUMSIM_DOC_TYPE, ATOM_DOC_TYPE, \ 
     27                      ATOM_BACKUP_DOC_TYPE] 
     28 
    2629    def __init__(self,uri,config=None): 
    2730        ''' Parse the uri and prepare for obtaining the actual content''' 
     
    115118             
    116119        # If this record is itself a discovery record, then we don't have much more to do 
    117         if self.schema in DISCOVERY_SCHEMES: 
     120        if self.schema in self.DISCOVERY_SCHEMES: 
    118121            self.xmlURL=self.__buildURL( 
    119122                discoveryBASE.replace('/view/','/retrieve/'),[qs,('format','raw')]) 
     
    121124            self.URL=self.discoveryURL 
    122125            if servicehost!='unknown':self.gettable=1 
    123         elif self.schema in BROWSE_SCHEMES: 
     126        elif self.schema in self.BROWSE_SCHEMES: 
    124127            # One day we'll use a service binding to get this 
    125128            # This is a mapping from the ndg repository id to an actual repository id 
     
    143146        if self.schema!='NumSim' and self.gettable<>-1: 
    144147            self.BURL=discoveryBASE.replace(self.schema,'NDG-B1') 
    145             self.BURL=self.BURL.replace(server,servicehost) 
     148            if server: 
     149                self.BURL=self.BURL.replace(server,servicehost) 
    146150            logging.debug("Set up stub-B url: '%s'" %self.BURL) 
    147151 
Note: See TracChangeset for help on using the changeset viewer.