Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify IOPlugin.Data initialization #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Lekensteyn
Copy link
Contributor

Remove the need to specify every component of Data. This introduces a
new IOPlugin.PersistedData member which is the same as IOPlugin.Data,
except that it is initialized with boolean False instead of None.

Also remove account_key and key from FullChainFile, it is not stored by
ChainFile. Replace a weird IOPlugin.EMPTY_DATA._replace(key=X) hack by
the more intuitive Data(key=X).

The __defaults__ construct is taken from
http://stackoverflow.com/a/18348004 and documented in
https://docs.python.org/2/reference/datamodel.html and
https://docs.python.org/3/reference/datamodel.html

Remove the need to specify every component of Data. This introduces a
new IOPlugin.PersistedData member which is the same as IOPlugin.Data,
except that it is initialized with boolean False instead of None.

Also remove account_key and key from FullChainFile, it is not stored by
ChainFile. Replace a weird `IOPlugin.EMPTY_DATA._replace(key=X)` hack by
the more intuitive `Data(key=X)`.

The `__defaults__` construct is taken from
http://stackoverflow.com/a/18348004 and documented in
https://docs.python.org/2/reference/datamodel.html and
https://docs.python.org/3/reference/datamodel.html
@Lekensteyn Lekensteyn force-pushed the ioplugin-data-simplify branch from f4440f5 to d7dc719 Compare January 8, 2016 09:41
@@ -689,13 +693,11 @@ def load(self):
cert, chain = None, None
else:
cert, chain = data.chain[0], data.chain[1:]
return self.Data(account_key=data.account_key, key=data.key,
cert=cert, chain=chain)
return self.Data(cert=cert, chain=chain)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reusing data.account_key or data.key was intentional - it plays well with the inheritance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants