Changeset 4535 for exist


Ignore:
Timestamp:
04/12/08 16:29:18 (11 years ago)
Author:
cbyrom
Message:

Generalise existing methods to allow data entities to be looked up with
the same code as associated deployments data + add new templates to
display the DEs + extend the javascript to allow multiple callbacks
to retrieve the info + various tidy ups and fixes.

Location:
exist/trunk/python/ndgUtils
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • exist/trunk/python/ndgUtils/lib/utilities.py

    r4532 r4535  
    3030    logging.debug("Checking validity of uri, '%s'" %uri) 
    3131    # set the socket timeout period 
    32     socket.setdefaulttimeout(10) 
     32    socket.setdefaulttimeout(20) 
    3333     
    3434    try: 
  • exist/trunk/python/ndgUtils/models/Atom.py

    r4531 r4535  
    11661166        ''' 
    11671167        logging.info("Looking up %s info" %type) 
    1168         self.deployments = [] 
     1168         
    11691169        self.allActivities = [] 
    11701170        self.allObs = [] 
     
    11751175         
    11761176        # avoid duplicating lookup effort 
    1177         if type == VTD.DEPLOYMENT_TERM and self.deployments: 
     1177        if (type == VTD.DEPLOYMENT_TERM and self.deployments) or \ 
     1178            (type == VTD.DE_TERM and self.dataEntities): 
    11781179            logging.info("- this info has already been looked up - returning") 
    11791180            return 
     
    11811182        # firstly, collect all the references to the info required 
    11821183        if lookupIndirectReferences: 
     1184            logging.info("Looking up indirect references") 
    11831185             
    11841186            # if we're looking up DE data for deployments data, need to have the 
     
    11891191            logging.info("Looking up references to this atom from other %s" %type) 
    11901192             
     1193            # NB, if we're looking up deployments info, we only look up references 
     1194            # to this atom - if we're looking up DEs, we need to look up references 
     1195            # to the deployments referenced by this atom 
    11911196            urls = [self.atomBrowseURL] 
    11921197             
     
    12031208                tree = ET.fromstring(doc) 
    12041209                for atom in tree: 
    1205                     logging.debug("- found reference in deployment") 
     1210                    logging.debug("- found reference in %s" %type) 
    12061211                    links.append(ET.tostring(atom)) 
     1212                     
     1213            logging.info("Finished looking up indirect references") 
    12071214        else: 
    12081215            links = self.getLinksOfType(self.VTD.DEPLOYMENT_TERM) 
    12091216 
    1210         # now retrieve the refererences and extract the required data 
     1217        # now retrieve the references and extract the required data 
     1218        logging.info("Retrieving info from %s references" %type) 
    12111219        if type == VTD.DEPLOYMENT_TERM: 
     1220            self.deployments = [] 
    12121221            for link in links: 
    12131222                if lookupIndirectReferences: 
     
    12261235        else: 
    12271236            # for DE data, just store the title + link in a Link object 
    1228             deLinks = [] 
     1237            self.dataEntities = [] 
    12291238            for data in links: 
    12301239                atom = Atom(xmlString=str(data)) 
     
    12321241                link.title = atom.title 
    12331242                link.href = atom.atomBrowseURL 
    1234                 deLinks.append(link) 
    1235              
    1236             self.dataEntities = deLinks 
    1237          
     1243                 
     1244                # NB, different deployments may be used by the same DE - so  
     1245                # avoid duplication 
     1246                self.addUniqueLinks(self.dataEntities, link) 
     1247             
    12381248        logging.info("Finished looking up %s info" %type) 
    12391249 
  • exist/trunk/python/ndgUtils/models/Deployment.py

    r4531 r4535  
    2222        self.obs = [] 
    2323        self.dpts = [] 
    24         self.browseURL = None 
    2524         
    2625        # add the deployment info appropriately 
     
    3029        self.startDate = deploymentAtom.t1 
    3130        self.endDate = deploymentAtom.t2 
     31        self.browseURL = deploymentAtom.atomBrowseURL 
    3232        logging.debug("Deployment created") 
    3333 
     
    4848        elif deploymentLink.rel.startswith(VTD.TERM_DATA[VTD.DPT_TERM].vocabURL): 
    4949            deploymentType = self.dpts 
    50         elif deploymentLink.rel == "self": 
    51             logging.debug("Found self referencing link - extract href") 
    52             self.browseURL = deploymentLink.href 
    53             return 
    5450        else: 
    5551            logging.debug("Not a valid deployment type (%s) - ignoring" \ 
Note: See TracChangeset for help on using the changeset viewer.