[EMAIL PROTECTED] wrote:
Hi,

I am wondering if there is a standard method to duplicate(shallow/deep
copy) a SQLObject instance. Something along the line of :

class A(SQLObject):
      ...definitions...

a = A(field=x)
b = A(a)

You'd have to do something like:

cols_names = a.sqlmeta.columns.keys()
col_values = dict([(name, getattr(a, name)) for name in col_names])
b = A(**col_values)

Of course, you could add a .clone() method that did just that, if you wanted.

--
Ian Bicking  /  [EMAIL PROTECTED]  /  http://blog.ianbicking.org

Reply via email to