created a shallow clone method
authorerickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 22 Jan 2008 19:09:37 +0000 (19:09 +0000)
committererickson <erickson@9efc2488-bf62-4759-914b-345cdb29e865>
Tue, 22 Jan 2008 19:09:37 +0000 (19:09 +0000)
git-svn-id: svn://svn.open-ils.org/OpenSRF/trunk@1225 9efc2488-bf62-4759-914b-345cdb29e865

src/python/osrf/net_obj.py

index b71ee69..beed013 100644 (file)
@@ -75,6 +75,16 @@ class NetworkObject(object):
         ''' Returns the registry object for this registered class '''
         return self.__class__.registry
 
+    def shallow_clone(self):
+        ''' Makes a shallow copy '''
+        reg = self.get_registry()
+        obj = new_object_from_hint(reg.hint)
+        for field in reg.keys:
+            obj.set_field(field, self.get_field(field))
+        return obj
+            
+
+
 def new_object_from_hint(hint):
     ''' Given a hint, this will create a new object of that 
         type and return it.  If this hint is not registered,