我正在使用 SQLObject,我有以下内容:
# update foo if it exists, otherwise create a new one
if self.foo_exists:
Foo.get(foo_id).set(name = foo['name'], ip = foo['ip'], port = foo['port'], mode = foo['mode'], max_conn = foo['max_conn'])
else:
Foo(name = foo['name'], ip = foo['ip_address'], port = foo['port'], mode = foo['mode'], max_conn = foo['max_conn'])
它运作良好,但我真的很想删除重复。我将完全相同的论点传递给Foo()
我.set()
。
我尝试传递一个 dict 但 SQLObject 不支持它。