Ignore:
Timestamp:
25/03/09 08:58:07 (11 years ago)
Author:
spascoe
Message:

Merging changes in the nappy package from trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nappy/branches/nappy-eggable/nappy/utils/common_utils.py

    r3999 r5138  
    146146 
    147147    d = {} 
    148     items = value.split(",") 
     148    items = s.split(",") 
    149149    while len(items) > 0: 
    150150        d[items[0]] = items[1] 
    151151        items = items[2:]  
    152152    return d 
     153 
     154 
     155def makeListFromCommaSepString(s): 
     156    """ 
     157    Reads in comma-separated list and converts to list of successive 
     158    keyword,value pairs. 
     159    """ 
     160    if s.count(",") % 2 == 0: 
     161        raise Exception("Must provide even number of items in argument of commas-separated pairs of values: " + s) 
     162 
     163    l = [] 
     164    items = s.split(",") 
     165    while len(items) > 0: 
     166        l.append((items[0], items[1])) 
     167        items = items[2:] 
     168    return l 
    153169 
    154170 
Note: See TracChangeset for help on using the changeset viewer.