[Pulp-list] Api.update()

Jay Dobies jason.dobies at redhat.com
Wed Mar 9 16:42:15 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 03/09/2011 11:18 AM, Jeff Ortel wrote:
> After working through the "Update Semantics" story is seemed to me the
> proposed update signature:
> 
> Api.update(delta={})
> 
> was kind of odd.  It was originally proposed this way to be more
> comparable with how the update() was being used whereby a model object
> was begin passed.  Now that semantics have been changed and a dictionary
> (delta) of changed fields and/or keywords is passed, it seems to make
> more sense to pass the object ID separate and *not* in the delta.
> 
> So, unless there are objections, I'm changing the signature to be:
> 
> Api.update(id, delta={})
> 
> However, I am bullet proofing the impls to ignore the 'id' within the
> 'delta'.

+1

I took a similar approach with the changes to the repo update messages
sent to consumers. I wanted the ability to send an updated host list
without resending the repo object itself so that the consumer has a
better idea of what it was that changed. So instead of my first approach:

update(repo, host_urls, gpg_keys)

I went with:

update(repo_id, repo, host_urls, gpg_keys)

I prefer that approach, it just feels cleaner IMO.

One thing about that signature though, it'd be a legal call to just say
Api.update('repo1') without passing in any deltas, which doesn't make
much sense. It's not really a concern (the caller should know better
than to do that), just curious if there's a reason for it.

- -- 
Jay Dobies
RHCE# 805008743336126
Freenode: jdob
http://pulpproject.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJNd63nAAoJEOMmcTqOSQHCrXUH/jTiI1tDnL3F8iZ5V/s1DI3x
t/ciKc5KUYSfORodJjfGPE3dllsNO+mPBcNDoejo+xhckebG+OtdnD6OlkVTyko+
EsHIG6vnLSMdDrk9/zwbxjdWMMEgA14rg2LMYW5dM6gwQTlOnB/Mq1oyUSZRteyB
yUuF+/P1oaefvfaFnzcLJvdtVc7liL+6nu1Y3E9lCntcAM/BsSxQLscXTBRB50dN
iMoOACtKLbhRGL1/pFwgwShDH3Y7cxGfbTa1nG7dWHEVsLEHTkrCYr+9PoV34e3C
W/Yya3GRZRmMPg66qt1GLK3KhV94dcYfvGXoY2iF2dg0rDYaF98SoNdCliOKGgg=
=2k3f
-----END PGP SIGNATURE-----




More information about the Pulp-list mailing list