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

Adjust atom retrieval code to allow filtering of atoms in the 'working'
state - NB, when in browse mode, these atoms should not be available
for display.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/dal/ndgRetrieve.py

    r5009 r5170  
    140140        self.pwf= self.config.get('NDG_EXIST','passwordFile') 
    141141        self.proxyServer = self.config.get('DEFAULT','proxyServer') 
    142          
    143142 
    144143 
    145144    def retrieveDoc(self, ndgObject, outputFormat = None, 
    146                     useRemoteEXist = None, useDiscovery = None): 
     145                    useRemoteEXist = None, useDiscovery = None, filterAtoms = False): 
    147146        ''' 
    148147        Retrieve the doc represented by the specified ndgURI in the specified format 
     
    158157        - also, note, these are just the default values; they can be overridden on  
    159158        calls to retrieveDoc()  
     159        @keyword filterAtoms: if True, remove any atoms in the Working state - NB, these 
     160        should not be visible in 'browse' mode  
    160161        @return: status, doc: status = 0 if fails, or 1 if succeeds. doc = retrieved 
    161162        doc in string format 
     
    198199            time2 = time.time()-time1 
    199200            logging.info('Document retrieve [%s] took [%s]'%(ndgObject, time2)) 
     201             
     202            if doc and filterAtoms: 
     203                xq = client.resources.xq['atomFullPath'] 
     204                 
     205                # set the query up with the correct target collection 
     206                xq=xq.replace('TargetCollection', target) 
     207                xq=xq.replace('RepositoryID',ndgObject.repository) 
     208                xq=xq.replace('LocalID',ndgObject.localID) 
     209                docPath = client.client.runQuery(xq) 
     210                if docPath[0].find('/db/atoms/working') > -1: 
     211                    doc = "Document unavailable for view" 
     212                    return 0, doc 
     213                 
    200214        except Exception,e: 
    201215            error = str(e) 
Note: See TracChangeset for help on using the changeset viewer.