Changeset 3419


Ignore:
Timestamp:
14/02/08 14:09:52 (11 years ago)
Author:
cbyrom
Message:

Add new field to DIF object representing the KML URL when this is available.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/DIF.py

    r3159 r3419  
    1010from ndgObject import ndgObject 
    1111from stubB import collapse2 
     12import urllib 
     13 
    1214try: #python 2.5 
    1315    from xml.etree import ElementTree as ET 
     
    169171        #services 
    170172        self.services=[] 
    171  
     173         
     174        # not all DIFs have KML resource available - set default value 
     175        # to the entryID for checking later on 
     176        self.kmlURL = self.entryID 
    172177        for item in helper.findall(self.tree,'Related_URL'): 
     178            contentType=helper.getText(item,'URL_Content_Type') 
     179            serviceURL=helper.cleanup.undo(helper.getText(item,'URL')) 
    173180            self.services.append( 
    174181                DIFService( 
    175                  helper.getText(item,'URL_Content_Type'), 
    176                  helper.cleanup.undo(helper.getText(item,'URL')), 
     182                 contentType, 
     183                 serviceURL, 
    177184                 helper.getText(item,'Description') )) 
     185            # if there is a KML URL, encode it and add it as a field for 
     186            # easy access to store in session data for selectedItems 
     187            # NB, it needs to be encoded to avoid problems whilst sending 
     188            # via AJAX  
     189            if contentType.find('KML') > 0: 
     190                # NB, adding the '' to quote forces forward slashes to be replaced 
     191                self.kmlURL = urllib.quote(serviceURL,'') 
    178192         
    179193        if self.ndgObject is None: 
Note: See TracChangeset for help on using the changeset viewer.