ajack 2004/07/14 14:15:54
Modified: python/gump/utils domutils.py
Log:
Debugging attribute type mismatch...
Revision Changes Path
1.3 +19 -14 gump/python/gump/utils/domutils.py
Index: domutils.py
===================================================================
RCS file: /home/cvs/gump/python/gump/utils/domutils.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- domutils.py 8 Jul 2004 20:33:06 -0000 1.2
+++ domutils.py 14 Jul 2004 21:15:54 -0000 1.3
@@ -93,22 +93,27 @@
if hasattr(target,attrName):
# Determine the type
attrType=type(getattr(target,attrName))
-
- if attrType is bool:
- if 'true' == value:
- value=True
+
+ try:
+ if attrType is bool:
+ if 'true' == value:
+ value=True
+ else:
+ value=False
+ elif attrType is int:
+ value=int(value)
+ elif attrType is str or attrType is unicode:
+ pass
else:
- value=False
- elif attrType is int:
- value=int(value)
- elif attrType is str or attrType is unicode:
- pass
- else:
- log.warn('Unknown Type %s for Attribute %s' % (attrType, attrName))
+ log.warn('Unknown Type %s for Attribute %s' % (attrType, attrName))
+
- #print 'Transfer ', attrName, ' -> ', value, ' [', attrType, ']'
- setattr(target,attrName,value)
- set+=1
+ #print 'Transfer ', attrName, ' -> ', value, ' [', attrType, ']'
+ setattr(target,attrName,value)
+ set+=1
+ except:
+ log.warn('Error with Type %s for Attribute %s' % (attrType, attrName))
+ raise
return set
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]