You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which sure looks a lot like method chaining where each call returns self. When I read the documentation, for the individual functions, such as CertificateBuilder.subnect_name()
Sets the subject’s distinguished name.
Parameters:
name – The [Name](https://cryptography.io/en/latest/x509/reference/#cryptography.x509.Name) that describes the subject.
the documentation states that the method will set the name, again consistent with method chaining.
However, when I try to invoke this code using the method chaining's alternative form:
things don't work. It turns out that, rather than setting the existing builder, each of the above calls return a new instance of the builder. Which means that:
Yes, we should change the documentation to more clearly indicate this: "Returns a new builder with the certificate's subject to this value.", and with :return: annotations.
Would you be interested in submitting a pull request for this?
ref Method Chining
The documentation for Creating a self-signed certificate has the example:
which sure looks a lot like method chaining where each call returns
self
. When I read the documentation, for the individual functions, such as CertificateBuilder.subnect_name()the documentation states that the method will set the name, again consistent with method chaining.
However, when I try to invoke this code using the method chaining's alternative form:
things don't work. It turns out that, rather than setting the existing builder, each of the above calls return a new instance of the builder. Which means that:
must be used.
The only hint I've seen of this is in
CertificateBuilder
reference documentation which uses the above; but without explanation.The text was updated successfully, but these errors were encountered: