Skip to content

Commit

Permalink
Merge branch 'master' into django4-upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
RonShub authored Mar 26, 2023
2 parents 51ce7c9 + 8f8cadb commit 97a8eda
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 28 deletions.
10 changes: 8 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
dist: xenial
language: python
python:
- "2.7"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
- "3.7"
- "pypy"
- "pypy3"

env:
global:
- DJF_USERNAME=postgres

services:
- postgresql

install: travis_retry pip install coveralls tox-travis

before_script:
- psql -c 'create database djftest;' -U postgres

script: tox

after_success: coveralls
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ CHANGES
master (unreleased)
-------------------

0.6 (2019.05.10)
----------------

* Support Postgres 10
* Drop support for Django < 1.11, Python 3.3/3.4
* Add support for Django 1.11 through 2.2, Python 3.7

0.5 (2017.02.22)
----------------

Expand Down
3 changes: 1 addition & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ django-fernet-fields
`Fernet`_ symmetric encryption for Django model fields, using the
`cryptography`_ library.

``django-fernet-fields`` supports `Django`_ 1.8.2 and later on Python 2.7, 3.3,
3.4, pypy, and pypy3.
``django-fernet-fields`` supports `Django`_ 1.11 and later on Python 2.7, 3.5, 3.6, 3.7, pypy, and pypy3.

Only PostgreSQL, SQLite, and MySQL are tested, but any Django database backend
with support for ``BinaryField`` should work.
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ won't be able to use a simple ``AlterField`` operation. Since your database has
no access to the encryption key, it can't update the column values
correctly. Instead, you'll need to do a three-step migration dance:

1. Add the new encrypted field with a different name.
1. Add the new encrypted field with a different name and initialize its values as `null`, otherwise decryption will be attempted before anything has been encrypted.
2. Write a data migration (using RunPython and the ORM, not raw SQL) to copy
the values from the old field to the new (which automatically encrypts them
in the process).
Expand Down
2 changes: 1 addition & 1 deletion fernet_fields/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def get_db_prep_save(self, value, connection):
retval = self.fernet.encrypt(force_bytes(value))
return connection.Database.Binary(retval)

def from_db_value(self, value, expression, connection, context):
def from_db_value(self, value, expression, connection, *args):
if value is not None:
if value not in self.allowed_unencrypted_values:
value = self.fernet.decrypt(force_bytes(value))
Expand Down
1 change: 1 addition & 0 deletions fernet_fields/test/settings/pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
# matches travis config
'NAME': 'djftest',
'TEST': {
'NAME': 'djftest',
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Requirements for running django-fernet-fields tests

Django>=1.8.2
Django>=1.11

cryptography>=0.9

Expand All @@ -9,7 +9,7 @@ pytest-django>=2.8.0
pytest>=2.7.3
coverage>=3.7.1

psycopg2>=2.6
psycopg2>=2.7
psycopg2cffi>=2.6.1

Sphinx>=1.3.1
Expand Down
7 changes: 4 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ def get_version():
version=get_version(),
description="Fernet-encrypted model fields for Django",
long_description=long_description,
long_description_content_type='text/x-rst',
author='ORCAS, Inc',
author_email='[email protected]',
url='https://github.com/orcasgit/django-fernet-fields/',
packages=find_packages(),
install_requires=['Django>=1.8.2', 'cryptography>=0.9'],
install_requires=['Django>=1.11', 'cryptography>=0.9'],
classifiers=[
'Environment :: Web Environment',
'Intended Audience :: Developers',
Expand All @@ -32,9 +33,9 @@ def get_version():
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Framework :: Django',
Expand Down
33 changes: 16 additions & 17 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
[tox]
envlist =
py36-{docs,flake8},
py{27,33,34,py,py3}-django18-{pg,sqlite},
py{27,34,35,py}-django{19,110}-{pg,sqlite},
py{27,34,35,36,py}-django111-{pg,sqlite},
py{35,36}-djangotrunk-{pg,sqlite},
py{27,py}-django{18,19,110,111}-mysql,
py{27,35,36,37,py}-django111-{pg,sqlite},
py{35,36,37}-{django21,django22,djangolatest}-{pg,sqlite},
flake8,
docs

[testenv]
deps =
pytest-django==2.8.0
pytest==2.7.3
py==1.4.30
coverage==3.7.1
django18: Django>=1.8,<1.9
django19: Django>=1.9,<1.10
django110: Django>=1.10,<1.11
django111: Django>=1.11a1,<2
djangotrunk: https://github.com/django/django/tarball/master
py{26,27,33,34,35,36}-pg: psycopg2==2.6
{pypy,pypy3}-pg: psycopg2cffi==2.6.1
mysql: MySQL-python==1.2.5
-crequirements.txt
cryptography
pytest-django
pytest
coverage

psycopg2
psycopg2cffi

django111: Django>=1.11,<2
django21: Django>=2.1,<2.2
django22: Django>=2.2,<2.3
djangolatest: Django>=2.2

# Older PyPy versions (and all released PyPy3 versions) don't work with cryptography 1.0
py{py,py3}: cryptography<1
setenv =
Expand Down

0 comments on commit 97a8eda

Please sign in to comment.