support non unicode fields

This commit is contained in:
Jan Dittberner 2010-06-03 22:25:46 +02:00
parent ce83914398
commit cce0d82f56

View file

@ -50,9 +50,16 @@ def build_urls(fields):
"""Build personalized URLs using the developer information in """Build personalized URLs using the developer information in
fields.""" fields."""
data = [] data = []
qfields = dict([(key, quote_plus(fields[key].encode('utf8'))) \ qfields = {}
for key in fields \ for key, value in fields.iteritems():
if fields[key] is not None and isinstance(fields[key], unicode)]) if value is not None:
if isinstance(value, unicode):
qfields[key] = quote_plus(value.encode('utf8'))
elif isinstance(value, str):
qfields[key] = quote_plus(value)
else:
qfields[key] = value
if 'gpgfp' not in qfields: if 'gpgfp' not in qfields:
fpr = keyfinder.getFingerprintByEmail(fields['email'].encode('utf8')) fpr = keyfinder.getFingerprintByEmail(fields['email'].encode('utf8'))
if fpr: if fpr: