r6883 - online-desktop/trunk/pyddm/ddm



Author: otaylor
Date: 2007-11-08 15:23:15 -0600 (Thu, 08 Nov 2007)
New Revision: 6883

Modified:
   online-desktop/trunk/pyddm/ddm/AbstractModel.py
Log:
Add more careful checking of type of resource argument to query_resource()

Modified: online-desktop/trunk/pyddm/ddm/AbstractModel.py
===================================================================
--- online-desktop/trunk/pyddm/ddm/AbstractModel.py	2007-11-08 20:50:28 UTC (rev 6882)
+++ online-desktop/trunk/pyddm/ddm/AbstractModel.py	2007-11-08 21:23:15 UTC (rev 6883)
@@ -87,8 +87,10 @@
 
         if isinstance(resource, Resource):
             resource_id = resource.resource_id
+        elif isinstance(resource, basestring):
+            resource_id = resource
         else:
-            resource_id = resource
+            raise ValueError("resource argument must be Resource or resource ID, not %r" % resource)
         
         return self.query(("http://mugshot.org/p/system";, "getResource"),
                           fetch,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]