Ignore:
Timestamp:
19/02/08 11:56:06 (12 years ago)
Author:
cbyrom
Message:

Add simple object to stubB to represent selected items and retain the important
associated data.
Add new utility method, recreateListFromUnicode(string), to recreate the KML and
WMC URL lists passed via AJAX calls as unicode strings.

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server/models
Files:
2 edited

Legend:

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

    r2755 r3456  
    171171     
    172172 
     173def recreateListFromUnicode(string): 
     174    ''' Parse a list that has been passed as unicode over http and 
     175    recreate it in its list form 
     176    ''' 
     177    newList = [] 
     178    element = [] 
     179    for c in string: 
     180        if c == '[' or c == ' ' or c == ']' or c == '\'': 
     181            continue 
     182        elif c == ',': 
     183            if (len(element) > 0): 
     184                newList.append(''.join(element)) 
     185                element = [] 
     186            continue 
     187        element.append(c) 
     188 
     189    # don't forget the last element 
     190    if (len(element) > 0): 
     191        newList.append(''.join(element)) 
     192         
     193    return newList 
    173194 
    174195         
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/stubB.py

    r3102 r3456  
    1414from People import * 
    1515from ndgObject import ndgObject 
     16from ows_server.models import Utilities 
    1617 
    1718#from DeploymentHandling import * 
     
    7980            self.parameters=helper.getText(elem,'dgGranuleSummary/dgParameterSummary/ParameterName',multiple=1) 
    8081            
     82class SelectedItem: 
     83    ''' A simple object representing key info on selected items ''' 
     84    def __init__(self,entryID,title,kmlURL,wmcURL): 
     85            self.entryID = entryID 
     86            self.title = title 
     87            self.kmlURL = kmlURL 
     88            self.wmcURL = wmcURL 
     89            self.kmlList = Utilities.recreateListFromUnicode(kmlURL) 
     90            self.wmcList = Utilities.recreateListFromUnicode(wmcURL) 
    8191             
    8292class ObservationStation: 
Note: See TracChangeset for help on using the changeset viewer.