[Sqlalchemy-tickets] =?utf-8?q?Re=3A_=5Bsqlalchemy=5D_=23134=3A_association_object_can_be_inse?= =?
Brought to you by:
zzzeek
From: sqlalchemy <mi...@zz...> - 2006-05-19 03:12:31
|
IzEzNDogYXNzb2NpYXRpb24gb2JqZWN0IGNhbiBiZSBpbnNlcnRlZCB0d2ljZQ0KLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0rLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLQ0KICBSZXBvcnRlcjogIHp6emVlayAgICB8ICAgICAgIE93bmVyOiAgenp6ZWVr DQogICAgICBUeXBlOiAgZGVmZWN0ICAgIHwgICAgICBTdGF0dXM6ICBuZXcgICANCiAgUHJpb3Jp dHk6ICBjcml0aWNhbCAgfCAgIE1pbGVzdG9uZTogICAgICAgIA0KIENvbXBvbmVudDogIG9ybSAg ICAgICB8ICAgICBWZXJzaW9uOiAgICAgICAgDQpSZXNvbHV0aW9uOiAgICAgICAgICAgIHwgICAg S2V5d29yZHM6ICAgICAgICANCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tKy0tLS0tLS0tLS0tLS0t LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCkNvbW1lbnQgKGJ5IERhbmll bCBNaWxsZXIpOg0KDQogRG9lcyB0aGUgZm9sbG93aW5nIHRlc3QtY2FzZSBjb3JyZWN0bHkgcmVw cm9kdWNlIHRoZSBpc3N1ZT8gSWYgc28sIHRoZW4gSQ0KIGRvbid0IHRoaW5rIHRoaXMgaXMgYSBi dWcgaW4gU0EuIFJhdGhlciwgaXQncyBhIG1pcy1jb25maWd1cmF0aW9uIG9mIHRoZQ0KIHRhYmxl cy4gVGhlcmUgc2hvdWxkIGJlIGEgVU5JUVVFIGNvbnN0cmFpbnQgb24gdGhlICJlbnJvbCIgdGFi bGUgKG5vdGUNCiB0aGF0IEkgaGFkIHRvIHJlb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gIFN0cmlu ZygyMCksDQogICAgICAgICAgICAgICAgIEZvcmVpZ25LZXkoJ3N0dWRlbnQubmFtZScpLA0KICAg ICAgICAgICAgICAgICAjcHJpbWFyeV9rZXk9VHJ1ZSwgIyB1bmNvbW1lbnQgZm9yIGNvcnJlY3Qg YmVoYXZpb3INCiAgICAgICAgICAgICApLA0KICAgICAgICAgICAgIENvbHVtbigNCiAgICAgICAg ICAgICAgICAgJ2NvdXJzZV9pZCcsDQogICAgICAgICAgICAgICAgIFN0cmluZygyMCksDQogICAg ICAgICAgICAgICAgIEZvcmVpZ25LZXkoJ2NvdXJzZS5uYW1lJyksDQogICAgICAgICAgICAgICAg ICNwcmltYXJ5X2tleT1UcnVlLCAjIHVuY29tbWVudCBmb3IgY29ycmVjdCBiZWhhdmlvcg0KICAg ICAgICAgICAgICkNCiAgICAgICAgICkNCg0KICAgICAgICAgc3R1ZGVudFRibC5jcmVhdGUoKQ0K ICAgICAgICAgY291cnNlVGJsLmNyZWF0ZSgpDQogICAgICAgICBlbnJvbFRibC5jcmVhdGUoKQ0K DQogICAgIGRlZiB0ZWFyRG93bkFsbChzZWxmKToNCiAgICAgICAgIGVucm9sVGJsLmRyb3AoKQ0K ICAgICAgICAgc3R1ZGVudFRibC5kcm9wKCkNCiAgICAgICAgIGNvdXJzZVRibC5kcm9wKCkNCiAg ICAgICAgICN0ZXN0YmFzZS5kYi50YWJsZXMuY2xlYXIoKQ0KICAgICAgICAgc2VsZi51bmluc3Rh bGxfdGhyZWFkbG9jYWwoKQ0KDQogICAgIGRlZiBzZXRVcChzZWxmKToNCiAgICAgICAgIG9iamVj dHN0b3JlLmNsZWFyKCkNCiAgICAgICAgIGNsZWFyX21hcHBlcnMoKQ0KDQogICAgIGRlZiB0ZWFy RG93bihzZWxmKToNCiAgICAgICAgIGVucm9sVGJsLmRlbGV0ZSgpLmV4ZWN1dGUoKQ0KICAgICAg ICAgY291cnNlVGJsLmRlbGV0ZSgpLmV4ZWN1dGUoKQ0KICAgICAgICAgc3R1ZGVudFRibC5kZWxl dGUoKS5leGVjdXRlKCkNCg0KICAgICBkZWYgdGVzdF9tdWx0aXBsZV9yZWxhdGlvbnNfdG9fc2Ft ZV9lbnRpdHlfYXJjYW5lKHNlbGYpOg0KICAgICAgICAgY2xhc3MgU3R1ZGVudChvYmplY3QpOg0K ICAgICAgICAgICAgIGRlZiBfX2luaXRfXyhzZWxmLCBuYW1lPScnKToNCiAgICAgICAgICAgICAg ICAgc2VsZi5uYW1lID0gbmFtZQ0KICAgICAgICAgY2xhc3MgQ291cnNlKG9iamVjdCk6DQogICAg ICAgICAgICAgZGVmIF9faW5pdF9fKHNlbGYsIG5hbWU9JycpOg0KICAgICAgICAgICAgICAgICBz ZWxmLm5hbWUgPSBuYW1lDQogICAgICAgICBjbGFzcyBFbnJvbChvYmplY3QpOg0KICAgICAgICAg ICAgIGRlZiBfX2luaXRfXyhzZWxmLCBzdHVkZW50X2lkPScnLCBjb3Vyc2VfaWQ9JycpOg0KICAg ICAgICAgICAgICAgICBzZWxmLnN0dWRlbnRfaWQgPSBzdHVkZW50X2lkDQogICAgICAgICAgICAg ICAgIHNlbGYuY291cnNlX2lkID0gY291cnNlX2lkDQogICAgICAgICBTdHVkZW50Lm1hcHBlciA9 IG1hcHBlcihTdHVkZW50LCBzdHVkZW50VGJsKQ0KICAgICAgICAgRW5yb2wubWFwcGVyID0gbWFw cGVyKEVucm9sLCBlbnJvbFRibCwNCiAgICAgICAgICAgICBwcmltYXJ5X2tleT1bZW5yb2xUYmwu Yy5zdHVkZW50X2lkLCBlbnJvbFRibC5jLmNvdXJzZV9pZF0sDQogICAgICAgICAgICAgcHJvcGVy dGllcz17J3N0dWRlbnQnOnJlbGF0aW9uKFN0dWRlbnQubWFwcGVyLCBsYXp5PUZhbHNlKX0NCiAg ICAgICAgICkNCiAgICAgICAgIENvdXJzZS5tYXBwZXIgPSBtYXBwZXIoQ291cnNlLCBjb3Vyc2VU YmwsDQogICAgICAgICAgICAgcHJvcGVydGllcz17DQogICAgICAgICAgICAgICAgICdzdHVkZW50 cyc6IHJlbGF0aW9uKEVucm9sLCBsYXp5PUZhbHNlLCBwcml2YXRlPVRydWUsDQogYXNzb2NpYXRp b249U3R1ZGVudCkNCiAgICAgICAgICAgICB9DQogICAgICAgICApDQogICAgICAgICBjMSA9IENv dXJzZSgnQ291cnNlMScpDQogICAgICAgICBzMSA9IFN0dWRlbnQoJ1N0dWRlbnQxJykNCiAgICAg ICAgIGMxLnN0dWRlbnRzLmFwcGVuZChFbnJvbChzMS5uYW1lLCBjMS5uYW1lKSkNCiAgICAgICAg IGMxLnN0dWRlbnRzLmFwcGVuZChFbnJvbChzMS5uYW1lLCBjMS5uYW1lKSkNCiAgICAgICAgIHNl bGYuYXNzZXJ0XyhsZW4oYzEuc3R1ZGVudHMpID09IDIpDQogICAgICAgICBvYmplY3RzdG9yZS5m bHVzaCgpICMgdGhpcyB3aWxsIHByb2R1Y2UgYSBjb25zdHJhaW50IHZpb2xhdGlvbiBpZg0KIHRo ZQ0KICAgICAgICAgICAgICAgICAgICAgICAgICAgICAjICJlbnJvbCIgdGFibGUgaGFzIGEgdW5p cXVlIGNvbnN0cmFpbnQgb24gaXRzDQogUEsNCiAgICAgICAgIG9iamVjdHN0b3JlLmNsZWFyKCkN CiAgICAgICAgIGMgPSBDb3Vyc2UubWFwcGVyLmdldF9ieShuYW1lPSdDb3Vyc2UxJykNCiAgICAg ICAgIHNlbGYuYXNzZXJ0XyhsZW4oYy5zdHVkZW50cykgPT0gMSkgIyBQQVNTIChTQSBjb25zb2xp ZGF0ZXMgdGhlIHR3bw0KIHJvd3Mgb24gc2VsZWN0KQ0KICAgICAgICAgZW5yb2xfY291bnQgPSBF bnJvbC5tYXBwZXIuY291bnQoY291cnNlX2lkPSdDb3Vyc2UxJywNCiBzdHVkZW50X2lkPSdTdHVk ZW50MScpDQogICAgICAgICBzZWxmLmFzc2VydF8oZW5yb2xfY291bnQgPT0gMSkgIyBGQUlMDQog fX19DQoNC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