Changeset 4987 for ndgCommon


Ignore:
Timestamp:
18/02/09 10:45:08 (11 years ago)
Author:
cbyrom
Message:

Pull out common error string into instance variable - to improve
class testability.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ndgCommon/trunk/ndg/common/src/clients/xmldb/abstractsearchxmldbclient.py

    r4919 r4987  
    1313 
    1414    resources = ndgResources() 
     15    NO_DOCS_FOUND_ERROR = "No document found for the specified inputs" 
    1516     
    1617    def buildAndRunQuery(self, queryType, targetCollection,  
     
    2829        logging.debug("Building and running xquery") 
    2930        xquery = self.resources.createXQuery(queryType, targetCollection, providerID, localID) 
    30          
     31 
    3132        results = self.client.runQuery(xquery, useChunked = useChunked) 
    3233        logging.debug("Returning results from xquery") 
     
    5960                                            providerID, localID) 
    6061            if len(results) == 0: 
    61                 raise ValueError("No document found for the specified inputs") 
     62                raise ValueError(self.NO_DOCS_FOUND_ERROR) 
    6263             
    6364            xml=ET.fromstring(results[0]) 
     
    7374                                        providerID, localID) 
    7475        if len(results) == 0: 
    75             raise ValueError("No document found for the specified inputs") 
     76            raise ValueError(self.NO_DOCS_FOUND_ERROR) 
    7677        # NB, if retrieving backups, just get return first doc found - if we 
    7778        # need more granularity here, we can implement the functionality when required 
Note: See TracChangeset for help on using the changeset viewer.