Michael Pasternak has posted comments on this change. Change subject: sdk: Add empty export method to decorator base ......................................................................
Patch Set 3: (2 comments) http://gerrit.ovirt.org/#/c/24131/3//COMMIT_MSG Commit Message: Line 16: class VMSnapshotDisk(params.Disk, Base) Line 17: Line 18: This means that resource decorators implement the "export" method, Line 19: responsible for generating the XML representation of the entity, but Line 20: collection decorators don't implement it. collections decorators does not extend api objects, it's standalong wrappers therefore they do not need xml marshalling infra. Line 21: Line 22: There are situations where decorators are used as parameters, for Line 23: example, when creating a VM from a snapshot one could use the following Line 24: code: Line 44: they don't have such method. Line 45: Line 46: This usage is not good practice, and not efficient, it is better to Line 47: avoid using decorators as parameters: Line 48: Juan, you cannot stop from users using decorators, simply because they don't know that this is decorator, from user PoV this is just another sdk object, thus / src / ovirtsdk / xml / params.py: 273 has dedicated __setattr__(self, item, value) method especially designed to address this behaviour, e.g on ___setattr__ it extracts real sdk object from decorator and assign it, the thing is that __setattr__ invoked only when parameters set via constructor [1] and when they set via setter method [2] it got ignored. [1] snapshots = ovirtsdk.params.Snapshots(snapshots=[Snapshot()]) [2] snapshots.add_snapshot(snapshot) not sure it will work as you expect, marshalling all objects etc, please note that params.py:273 has a lot of logic, please try to apply it in generic way for all setters as it happens when objects are assigned via constructors. thanks. Line 49: snapshot = ovirtsdk.params.Snapshot(id="...") Line 50: snapshots = ovirtsdk.params.Snapshots() Line 51: snapshots.add_snapshot(snapshot) Line 52: newvm = ovirtsdk.xml.params.VM( -- To view, visit http://gerrit.ovirt.org/24131 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I7843dea85c9f09de5fb3439f57dba71ce6a28898 Gerrit-PatchSet: 3 Gerrit-Project: ovirt-engine-sdk Gerrit-Branch: master Gerrit-Owner: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: Juan Hernandez <juan.hernan...@redhat.com> Gerrit-Reviewer: Michael Pasternak <mishka8...@yahoo.com> Gerrit-Reviewer: Ravi Nori <rn...@redhat.com> Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches