[Opensrf-commits] r1225 - trunk/src/python/osrf
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Jan 22 14:36:07 EST 2008
Author: erickson
Date: 2008-01-22 14:09:37 -0500 (Tue, 22 Jan 2008)
New Revision: 1225
Modified:
trunk/src/python/osrf/net_obj.py
Log:
created a shallow clone method
Modified: trunk/src/python/osrf/net_obj.py
===================================================================
--- trunk/src/python/osrf/net_obj.py 2008-01-22 16:35:51 UTC (rev 1224)
+++ trunk/src/python/osrf/net_obj.py 2008-01-22 19:09:37 UTC (rev 1225)
@@ -75,6 +75,16 @@
''' 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,
More information about the opensrf-commits
mailing list