← Back to team overview

maas-devel team mailing list archive

Re: idempotent()

 

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

http://ruben.verborgh.org/blog/2012/07/19/get-doesnt-change-the-world/

claims that GET is both "idempotent" and "safe" (meaning it doesn't
change the world).

I don't know what word you want to use there (idempotentAndSafe=True)?

I was thinking something like "doesn't mutate state", "no changes",
etc. Which is what you expect of GET vs POST, which is why this
operation *shouldn't* be done via GET.

John
=:->


On 2014-02-18 12:49, Gavin Panella wrote:
> Following on from the discussion about idempotent() on 
> https://code.launchpad.net/~rvb/maas/bulk-add-networks-to-node/+merge/206708:
>
>  An idempotent update could be submitted multiple times, and the
> state would not change after the first submission.
> 
> If that holds, why not do it as a GET request? It's harmless to
> submit multiple times? No. If the state changes between
> submissions, in response to a separate event, a subsequent
> submission of that idempotent POST might well have an effect beyond
> what we intended.
> 
> I don't know if that means it still qualifies as idempotent or
> not, but something I think we'd like to avoid is user agents
> resubmitting the original request without asking the user, for
> example. In other words, although we consider it idempotent, we
> want to use POST so that user agents do the Right Thing.
> 
> Put another way, I think some of the things we thing of as
> idempotent are, in the real world of HTTP and multiple users and
> concurrency, not practically idempotent.
> 
> Even though I was the one who dreamt it up, I have no special love
> for the idempotent() decorator, and it's always felt imperfect. Can
> we come up with a compelling improvement that better conveys
> semantics over mechanics?
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.13 (Cygwin)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEARECAAYFAlMDIScACgkQJdeBCYSNAAOqmQCeKkswMeU4lANk0CjnhkCsknFP
lHUAn0X5ZdZi2+HUFXopMz5T0+zogM2/
=/XHw
-----END PGP SIGNATURE-----


References