Skip to content

Commit 97a8eda

Browse files
authored
Merge branch 'master' into django4-upgrade
2 parents 51ce7c9 + 8f8cadb commit 97a8eda

File tree

9 files changed

+41
-28
lines changed

9 files changed

+41
-28
lines changed

.travis.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1+
dist: xenial
12
language: python
23
python:
34
- "2.7"
4-
- "3.3"
5-
- "3.4"
65
- "3.5"
76
- "3.6"
7+
- "3.7"
88
- "pypy"
99
- "pypy3"
1010

1111
env:
1212
global:
1313
- DJF_USERNAME=postgres
1414

15+
services:
16+
- postgresql
17+
1518
install: travis_retry pip install coveralls tox-travis
1619

20+
before_script:
21+
- psql -c 'create database djftest;' -U postgres
22+
1723
script: tox
1824

1925
after_success: coveralls

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@ CHANGES
44
master (unreleased)
55
-------------------
66

7+
0.6 (2019.05.10)
8+
----------------
9+
10+
* Support Postgres 10
11+
* Drop support for Django < 1.11, Python 3.3/3.4
12+
* Add support for Django 1.11 through 2.2, Python 3.7
13+
714
0.5 (2017.02.22)
815
----------------
916

README.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ django-fernet-fields
1818
`Fernet`_ symmetric encryption for Django model fields, using the
1919
`cryptography`_ library.
2020

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

2423
Only PostgreSQL, SQLite, and MySQL are tested, but any Django database backend
2524
with support for ``BinaryField`` should work.

doc/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ won't be able to use a simple ``AlterField`` operation. Since your database has
169169
no access to the encryption key, it can't update the column values
170170
correctly. Instead, you'll need to do a three-step migration dance:
171171

172-
1. Add the new encrypted field with a different name.
172+
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.
173173
2. Write a data migration (using RunPython and the ORM, not raw SQL) to copy
174174
the values from the old field to the new (which automatically encrypts them
175175
in the process).

fernet_fields/fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def get_db_prep_save(self, value, connection):
9898
retval = self.fernet.encrypt(force_bytes(value))
9999
return connection.Database.Binary(retval)
100100

101-
def from_db_value(self, value, expression, connection, context):
101+
def from_db_value(self, value, expression, connection, *args):
102102
if value is not None:
103103
if value not in self.allowed_unencrypted_values:
104104
value = self.fernet.decrypt(force_bytes(value))

fernet_fields/test/settings/pg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
DATABASES = {
1111
'default': {
1212
'ENGINE': 'django.db.backends.postgresql_psycopg2',
13+
# matches travis config
1314
'NAME': 'djftest',
1415
'TEST': {
1516
'NAME': 'djftest',

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Requirements for running django-fernet-fields tests
22

3-
Django>=1.8.2
3+
Django>=1.11
44

55
cryptography>=0.9
66

@@ -9,7 +9,7 @@ pytest-django>=2.8.0
99
pytest>=2.7.3
1010
coverage>=3.7.1
1111

12-
psycopg2>=2.6
12+
psycopg2>=2.7
1313
psycopg2cffi>=2.6.1
1414

1515
Sphinx>=1.3.1

setup.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@ def get_version():
1818
version=get_version(),
1919
description="Fernet-encrypted model fields for Django",
2020
long_description=long_description,
21+
long_description_content_type='text/x-rst',
2122
author='ORCAS, Inc',
2223
author_email='[email protected]',
2324
url='https://github.com/orcasgit/django-fernet-fields/',
2425
packages=find_packages(),
25-
install_requires=['Django>=1.8.2', 'cryptography>=0.9'],
26+
install_requires=['Django>=1.11', 'cryptography>=0.9'],
2627
classifiers=[
2728
'Environment :: Web Environment',
2829
'Intended Audience :: Developers',
@@ -32,9 +33,9 @@ def get_version():
3233
'Programming Language :: Python :: 2',
3334
'Programming Language :: Python :: 2.7',
3435
'Programming Language :: Python :: 3',
35-
'Programming Language :: Python :: 3.3',
36-
'Programming Language :: Python :: 3.4',
3736
'Programming Language :: Python :: 3.5',
37+
'Programming Language :: Python :: 3.6',
38+
'Programming Language :: Python :: 3.7',
3839
'Programming Language :: Python :: Implementation :: CPython',
3940
'Programming Language :: Python :: Implementation :: PyPy',
4041
'Framework :: Django',

tox.ini

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,27 @@
11
[tox]
22
envlist =
33
py36-{docs,flake8},
4-
py{27,33,34,py,py3}-django18-{pg,sqlite},
5-
py{27,34,35,py}-django{19,110}-{pg,sqlite},
6-
py{27,34,35,36,py}-django111-{pg,sqlite},
7-
py{35,36}-djangotrunk-{pg,sqlite},
8-
py{27,py}-django{18,19,110,111}-mysql,
4+
py{27,35,36,37,py}-django111-{pg,sqlite},
5+
py{35,36,37}-{django21,django22,djangolatest}-{pg,sqlite},
96
flake8,
107
docs
118

129
[testenv]
1310
deps =
14-
pytest-django==2.8.0
15-
pytest==2.7.3
16-
py==1.4.30
17-
coverage==3.7.1
18-
django18: Django>=1.8,<1.9
19-
django19: Django>=1.9,<1.10
20-
django110: Django>=1.10,<1.11
21-
django111: Django>=1.11a1,<2
22-
djangotrunk: https://github.com/django/django/tarball/master
23-
py{26,27,33,34,35,36}-pg: psycopg2==2.6
24-
{pypy,pypy3}-pg: psycopg2cffi==2.6.1
25-
mysql: MySQL-python==1.2.5
11+
-crequirements.txt
12+
cryptography
13+
pytest-django
14+
pytest
15+
coverage
16+
17+
psycopg2
18+
psycopg2cffi
19+
20+
django111: Django>=1.11,<2
21+
django21: Django>=2.1,<2.2
22+
django22: Django>=2.2,<2.3
23+
djangolatest: Django>=2.2
24+
2625
# Older PyPy versions (and all released PyPy3 versions) don't work with cryptography 1.0
2726
py{py,py3}: cryptography<1
2827
setenv =

0 commit comments

Comments
 (0)