Changeset 4ed10ae for fedd/fedd_util.py
- Timestamp:
- Nov 14, 2008 5:13:10 PM (15 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
- Children:
- afa43a8
- Parents:
- 2dafa0c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedd/fedd_util.py
r2dafa0c r4ed10ae 287 287 288 288 289 def strip_unicode(obj): 290 """Walk through a message and convert all strings to non-unicode strings""" 291 if isinstance(obj, dict): 292 for k in obj.keys(): 293 obj[k] = strip_unicode(obj[k]) 294 return obj 295 elif isinstance(obj, basestring): 296 return str(obj) 297 elif getattr(obj, "__iter__", None): 298 return [ strip_unicode(x) for x in obj] 299 else: 300 return obj 301 302 def make_unicode(obj): 303 """Walk through a message and convert all strings to unicode""" 304 if isinstance(obj, dict): 305 for k in obj.keys(): 306 obj[k] = make_unicode(obj[k]) 307 return obj 308 elif isinstance(obj, basestring): 309 return unicode(obj) 310 elif getattr(obj, "__iter__", None): 311 return [ make_unicode(x) for x in obj] 312 else: 313 return obj 314 315 289 316 def generate_fedid(subj, bits=2048, log=None, dir=None, trace=sys.stderr): 290 317 """ … … 396 423 return handler 397 424 425 398 426 def set_log_level(config, sect, log): 399 427 """ Set the logging level to the value passed in sect of config."""
Note: See TracChangeset
for help on using the changeset viewer.