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.

File:
1 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         
Note: See TracChangeset for help on using the changeset viewer.