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

Feature new date fields #41

Merged
merged 5 commits into from
Jan 6, 2017
Merged

Feature new date fields #41

merged 5 commits into from
Jan 6, 2017

Conversation

peterfarrell
Copy link
Collaborator

  • Added .gitignore
  • Added support for DatePGPSymmetricKeyField and DateTimePGPSymmetricKeyField including support for serializing / deserializing django form fields
  • Fixed all Flake8 errors
  • Added unit tests for new fields

…cKeyField`. Fixed all Flake8 errors. Updated README. Added unit tests for fields and lookups that are implemented.
@peterfarrell
Copy link
Collaborator Author

The first run of Travis tests failed because fake-factory recently changed to faker. I updated the requirements and Travis is re-running the CI tests.


def __init__(self, lhs, rhs):
"""Implementing an abstract class."""
super(DateLookupBase, self).__init__(lhs, rhs) # pragma: no cover
Copy link
Collaborator

Choose a reason for hiding this comment

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

As we do nothing in __init__ except calling super, we don't need this method, you can remove it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If I remove it, I get warnings that I haven't implemented all abstract methods for PEP8 but more than willing to remove it.

def __init__(self, input_formats=None, *args, **kwargs):
"""Init that pops off the max_length attribute."""
kwargs.pop('max_length', None)
super(DateField, self).__init__(input_formats, *args, **kwargs)
Copy link
Collaborator

@kevinetienne kevinetienne Jan 6, 2017

Choose a reason for hiding this comment

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

This is python 3, you can remove the argument passed to self they would be filled by the compiler atomatically see https://docs.python.org/3/library/functions.html#super

Same comment apply for the DateTimeField class below and in pgcrypto.mixins.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Consider it done... used to support py2 and py3 stuff at the same time.

import factory

from .models import EncryptedModel


class EncryptedModelFactory(factory.DjangoModelFactory):
"""Factory to generate hashed and encrypted data."""
class Meta:
class Meta: # NOQA
Copy link
Collaborator

Choose a reason for hiding this comment

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

noqa is not needed in the tests module as it's ignored by coverage.

This is what coverage report (from travis):

Name                     Stmts   Miss  Cover   Missing
------------------------------------------------------
pgcrypto/__init__.py         8      0   100%
pgcrypto/aggregates.py      26      2    92%   59-65
pgcrypto/fields.py          38      0   100%
pgcrypto/forms.py            9      0   100%
pgcrypto/lookups.py         64      4    94%   60-63
pgcrypto/mixins.py          47      0   100%
pgcrypto/models.py           0      0   100%
pgcrypto/proxy.py           20      0   100%
------------------------------------------------------
TOTAL                      212      6    97%

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same comment apply for EncryptedModel.Meta in tests.models.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Consider it done.... There must of been a change of behavior in coverage since that requirement was upgraded yesterday. The #NOQA was needed in the past otherwise it complained about those lines.

@@ -0,0 +1,93 @@
# Created by .ignore support plugin (hsz.mobi)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it possible to remove this .gitignore? I think a few of the references are configuration specific. We might need a .gitignore to ignore files generated by the library but I think that most of the other cases can be fixed with a global gitignore.

See .gitignore from Django and the github doc about the global gitignore.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea, if you'd like it removed -- can do. We've used a rather broad coverage on .gitignore in our group in the past because different system configurations and not everyone notifies when some tool dumps an extra file.

I think some .gitignore file should be included however for now I will delete it. For example, when running unit tests a file for coverage results .coverage is generated. For those contributing to this project, they may not notice that file be added and accidentally commit it.

@kevinetienne
Copy link
Collaborator

kevinetienne commented Jan 6, 2017

Peter thank you very much for your contribution, it looks very good. Most of my comments are nitpicks I couldn't see anything to change in general. Once these comments are fixed I'll have a second read and if it's all good we can merge it to master :)

@peterfarrell
Copy link
Collaborator Author

@kevinetienne I committed all the changes you suggested in the review.

@kevinetienne
Copy link
Collaborator

Nice one! I'll do a release soon.

@kevinetienne kevinetienne merged commit a10ee8d into incuna:master Jan 6, 2017
@peterfarrell peterfarrell deleted the feature_new_date_fields branch January 6, 2017 16:25
@kevinetienne
Copy link
Collaborator

Release under 2.1.0 https://pypi.python.org/pypi/django-pgcrypto-fields

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.

None yet

2 participants