Ignore:
Timestamp:
07/10/08 17:38:34 (11 years ago)
Author:
cbyrom
Message:

Add convenience methods to determine whether a data item is a granule +
selected atom related links according to their type - to allow granules + deployments
to be associated with data entities.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/models/Atom.py

    r4296 r4301  
    903903        logging.info("Created formatted version of XML object") 
    904904        return prettyXML 
     905 
     906 
     907    def getLinksOfType(self, termID): 
     908        ''' 
     909        Returns links in the atom related links attribute which match the specified 
     910        term ID 
     911        @param termID: the termID to look for in the related links - NB, this is 
     912        matched to the end of the link.rel value 
     913        @return links: array of Link objects with matching term type  
     914        ''' 
     915        logging.debug("Getting atom links of type, '%s'" %termID) 
     916        matchingLinks = [] 
     917        for link in self.relatedLinks: 
     918            if link and link.rel and link.rel.lower().endswith(termID.lower()): 
     919                logging.debug("- found link with matching term type") 
     920                matchingLinks.append(link) 
     921 
     922        logging.debug("Returning matched links") 
     923        return matchingLinks 
Note: See TracChangeset for help on using the changeset viewer.