## XML and list utility functions
def urlencode(param_dict):
- params = ""
- for key,value in param_dict.items():
- if value == None:
- continue # ignore unused parameter
- #if type(value)== : # convert True/False to 'y'/<no-entry>
- # if value == True:
- # params += "%s=y&" % (key,)
- # #else:
- # # params += "%s=n&" % (key,)
- if value != None:
- params += "%s=%s&" % (key, str(value))
- if len(params) > 1:
- params = params[:-1] # remove trailing &
- return params
+ return urllib.urlencode(
+ [(k,v) for k,v in param_dict.iteritems() if v is not None])
def unique(seq, keepstr=True):
"""