Ignore:
Timestamp:
28/03/07 20:48:55 (14 years ago)
Author:
lawrence
Message:

Now using the SOAP call for all discovery D calls, rather than XMLRPC
for discovery portability ...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/PythonCode/wsgi/ndgSearch.py

    r2319 r2345  
    9393        return self.documents 
    9494 
    95     def getDoc(self,document): 
     95    def getDoc(self,document,format='original'): 
    9696        ''' Return a single document from the backend database ''' 
    9797         
     
    102102        request.Documents=DocList 
    103103        DocList.Document=[document,] 
    104         request.Format='original' 
     104        request.Format=format 
    105105        #try: 
    106106        searchResult=self.server.doPresent(request) 
     
    189189        return results 
    190190         
     191    def get(self,repository,schema,localID,format='original'): 
     192        ''' Obtain a document via it's NDG id split up ''' 
     193        uri='%s__%s__%s'%(repository,schema,localID) 
     194        fileName=uri+'.xml' 
     195        return self.getDoc(fileName,format) 
     196         
    191197         
    192198import unittest 
     
    243249        print s.hits 
    244250        print 'Hopefully this is also zero: if not, expect the Sequence test to fail:',s.hits 
    245  
    246          
     251         
     252    def testGet(self): 
     253        ''' Tests getting via uri components ''' 
     254        (r,s,l)='neodc.nerc.ac.uk','DIF','NEODC_ARSF_ATM_DAED' 
     255        ss=ndgSearch() 
     256        x=ss.get(r,s,l,format='DC') 
    247257 
    248258if __name__=="__main__": 
Note: See TracChangeset for help on using the changeset viewer.