def olddata_to_newdata(data, extra, paranoia): """Given raw data, the extra= tag, and paranoia setting, recreate the object that was passed to newdata_to_olddata.""" (module, klass) = extra.split() o = obj_from_name(klass, module, paranoia) #if isinstance(o,ComplexType) and \ # type(data) in [StringType,UnicodeType]: # # yuck ... have to strip () from complex data before # # passing to __init__ (ran into this also in one of the # # parsers ... maybe the () shouldn't be in the XML at all?) # if data[0] == '(' and data[-1] == ')': # data = data[1:-1] if isinstance_any(o,(IntType,FloatType,ComplexType,LongType)) and \ type(data) in [StringType,UnicodeType]: data = aton(data) o = setCoreData(o, data) return o
def olddata_to_newdata(data,extra,paranoia): """Given raw data, the extra= tag, and paranoia setting, recreate the object that was passed to newdata_to_olddata.""" (module,klass) = extra.split() o = obj_from_name(klass,module,paranoia) #if isinstance(o,ComplexType) and \ # type(data) in [StringType,UnicodeType]: # # yuck ... have to strip () from complex data before # # passing to __init__ (ran into this also in one of the # # parsers ... maybe the () shouldn't be in the XML at all?) # if data[0] == '(' and data[-1] == ')': # data = data[1:-1] if isinstance_any(o,(IntType,FloatType,ComplexType,LongType)) and \ type(data) in [StringType,UnicodeType]: data = aton(data) o = setCoreData(o,data) return o