Skip to content

Commit c2690c9

Browse files
committed
Merge branch 'release/0.9'
* release/0.9: bump 0.9 Squashed commit of the following: code clean and test refactoring add coveralls support updates README Squashed commit of the following: add unicode support to postgres backend updates CHANGES tests refactoring django 1.8 compatibility tests refactoring updates CHANGES fixes wrong pypi server in tox.ini merge #40 and fixes test suite Don't create triggers on abstract classes disable_concurrency() now accept instance or Model open 0.9 better use to setuptools. updates docs. fixes #38
2 parents 33c37fd + 0441dae commit c2690c9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+607
-785
lines changed

.coveragerc

Lines changed: 0 additions & 30 deletions
This file was deleted.

.travis.yml

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,68 @@
11
language: python
2+
python:
3+
- "2.7"
4+
- "3.4"
5+
6+
cache:
7+
- pip
8+
9+
sudo: false
10+
211
services:
312
- MySQL
413
- PostgreSQL
514

615
env:
7-
- TESTENV=p27d14pg
8-
- TESTENV=p27d15pg
9-
- TESTENV=p27d16pg
10-
- TESTENV=p27d17pg
11-
- TESTENV=p27dtrunkpg
12-
- TESTENV=p33d16pg
13-
- TESTENV=p27d16mysql
16+
- DJANGO=1.4.x DBENGINE=pg
17+
- DJANGO=1.5.x DBENGINE=pg
18+
- DJANGO=1.6.x DBENGINE=pg
19+
- DJANGO=1.7.x DBENGINE=pg
20+
- DJANGO=1.8.x DBENGINE=pg
21+
- DJANGO=dev DBENGINE=pg
1422

23+
- DJANGO=1.4.x DBENGINE=mysql
24+
- DJANGO=1.5.x DBENGINE=mysql
25+
- DJANGO=1.6.x DBENGINE=mysql
26+
- DJANGO=1.7.x DBENGINE=mysql
27+
- DJANGO=1.8.x DBENGINE=mysql
28+
- DJANGO=dev DBENGINE=pg
1529

1630
install:
17-
- make install-deps
31+
- pip install tox>=1.8
32+
- pip install python-coveralls>=2.5 coveralls>=0.5
33+
1834

1935
script:
20-
- make init-db
21-
- tox -e $TESTENV
36+
- make coverage
2237

38+
before_success:
39+
- coverage erase
2340

2441
after_success:
42+
- coverage combine
2543
- coveralls
44+
45+
matrix:
46+
allow_failures:
47+
- env: DJANGO=dev DBENGINE=pg
48+
49+
exclude:
50+
- python: "3.4"
51+
env: DJANGO=1.4.x DBENGINE=pg
52+
- python: "3.4"
53+
env: DJANGO=1.5.x DBENGINE=pg
54+
- python: "3.4"
55+
env: DJANGO=1.6.x DBENGINE=pg
56+
57+
- python: "3.4"
58+
env: DJANGO=1.4.x DBENGINE=mysql
59+
- python: "3.4"
60+
env: DJANGO=1.5.x DBENGINE=mysql
61+
- python: "3.4"
62+
env: DJANGO=1.6.x DBENGINE=mysql
63+
- python: "3.4"
64+
env: DJANGO=1.7.x DBENGINE=mysql
65+
- python: "3.4"
66+
env: DJANGO=1.8.x DBENGINE=mysql
67+
- python: "3.4"
68+
env: DJANGO=dev DBENGINE=mysql

CHANGES

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1+
Release 0.9
2+
-----------
3+
* django 1.8 compatibility
4+
* python 3.4 compatibility
5+
* **BACKWARD INCOMPATIBLE** :ref:`disable_concurrency` works differently if used with classes or instances
6+
* better support for external Models (models that are part of plugged-in applications)
7+
* fixes issue with TriggerVersioField and Proxy Models (thanx Richard Eames)
8+
9+
110
Release 0.8.1
211
-------------
312
* avoid to use concurrency when selecting all items (select_across)
413

14+
515
Release 0.8
616
-----------
717
* django 1.7 compatibility
818
* fixes typo in ``delete_selected_confirmation.html`` template
919
* python 3.2/3.3 compatibility
1020

21+
1122
Release 0.7.1
1223
-------------
13-
1424
* backward compatibility updates. Do not check for concurrency if `0` is passed as version value
1525
(ie. no value provided by the form)
1626

@@ -25,9 +35,9 @@ Release 0.7
2535
* fixed :issue:`23` (thanks matklad)
2636
* new :setting:`USE_SELECT_FOR_UPDATE`
2737

38+
2839
Release 0.6.0
2940
-------------
30-
3141
* new :ref:`disable_concurrency` context manager
3242
* added documentation for :ref:`concurrency.middleware.ConcurrencyMiddleware <concurrencymiddleware>`
3343
* **BACKWARD INCOMPATIBLE** Fixed typo: ``CONCURRECY_SANITY_CHECK`` now ``CONCURRENCY_SANITY_CHECK``
@@ -39,14 +49,12 @@ Release 0.6.0
3949

4050
Release 0.5.0
4151
-------------
42-
4352
* python 3.x compatibility
4453
* new :setting:`CONCURRENCY_FIELD_SIGNER`
4554

4655

4756
Release 0.4.0
4857
---------------------------------
49-
5058
* start deprecation of ``concurrency.core.VersionChangedError``, ``concurrency.core.RecordModifiedError``,
5159
``concurrency.core.InconsistencyError``,moved in ``concurrency.exceptions``
5260
* start deprecation of ``concurrency.core.apply_concurrency_check``, ``concurrency.core.concurrency_check`` moved in ``concurrency.api``

Makefile

Lines changed: 22 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,46 @@
11
VERSION=2.0.0
22
BUILDDIR='~build'
3-
PYTHONPATH := ${PWD}/demo/:${PWD}
3+
PYTHONPATH:=${PWD}/tests/:${PWD}
44
DJANGO_14='django>=1.4,<1.5'
55
DJANGO_15='django>=1.5,<1.6'
6-
DJANGO_16='django>=1.6,>1.7'
7-
DJANGO_17='https://www.djangoproject.com/download/1.7c1/tarball/'
6+
DJANGO_16='django>=1.6,<1.7'
7+
DJANGO_17='django>=1.7,<1.8'
8+
DJANGO_18='django>=1.8,<1.9'
89
DJANGO_DEV=git+git://github.com/django/django.git
9-
DBENGINE?=pg
10-
10+
DBENGINE?=sqlite
11+
DJANGO?='1.7.x'
1112

1213

1314
mkbuilddir:
1415
mkdir -p ${BUILDDIR}
1516

16-
1717
install-deps:
18-
pip install -q \
19-
-r requirements.pip python-coveralls \
20-
django_extensions
21-
22-
23-
locale:
24-
cd concurrency && django-admin.py makemessages -l en
25-
export PYTHONPATH=${PYTHONPATH}
26-
cd concurrency && django-admin.py compilemessages --settings=${DJANGO_SETTINGS_MODULE}
18+
@pip install "pip>=6.0.8"
19+
@pip install -qr requirements/tests.pip
20+
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then pip install MySQL-python; fi"
21+
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then pip install -q psycopg2; fi"
22+
@sh -c "if [ '${DJANGO}' = '1.4.x' ]; then pip install ${DJANGO_14}; fi"
23+
@sh -c "if [ '${DJANGO}' = '1.5.x' ]; then pip install ${DJANGO_15}; fi"
24+
@sh -c "if [ '${DJANGO}' = '1.6.x' ]; then pip install ${DJANGO_16}; fi"
25+
@sh -c "if [ '${DJANGO}' = '1.7.x' ]; then pip install ${DJANGO_17}; fi"
26+
@sh -c "if [ '${DJANGO}' = '1.8.x' ]; then pip install ${DJANGO_18}; fi"
27+
@sh -c "if [ '${DJANGO}' = 'dev' ]; then pip install ${DJANGO_DEV}; fi"
2728

2829

2930
init-db:
30-
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -e 'DROP DATABASE IF EXISTS concurrency;'; fi"
31-
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then pip install MySQL-python; fi"
32-
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -e 'CREATE DATABASE IF NOT EXISTS concurrency;'; fi"
31+
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -u root -e 'DROP DATABASE IF EXISTS concurrency;'; fi"
32+
@sh -c "if [ '${DBENGINE}' = 'mysql' ]; then mysql -u root -e 'CREATE DATABASE IF NOT EXISTS concurrency;'; fi"
3333

3434
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then psql -c 'DROP DATABASE IF EXISTS concurrency;' -U postgres; fi"
3535
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then psql -c 'CREATE DATABASE concurrency;' -U postgres; fi"
36-
@sh -c "if [ '${DBENGINE}' = 'pg' ]; then pip install -q psycopg2; fi"
37-
3836

3937
test:
40-
py.test -vvv
38+
py.test -v
4139

4240

43-
coverage: mkbuilddir
44-
py.test --cov=concurrency --cov-report=html --cov-report=term --cov-config=.coveragerc -vvv
45-
46-
47-
ci: init-db install-deps
48-
@sh -c "if [ '${DJANGO}' = '1.4.x' ]; then pip install ${DJANGO_14}; fi"
49-
@sh -c "if [ '${DJANGO}' = '1.5.x' ]; then pip install ${DJANGO_15}; fi"
50-
@sh -c "if [ '${DJANGO}' = '1.6.x' ]; then pip install ${DJANGO_16}; fi"
51-
@sh -c "if [ '${DJANGO}' = '1.7.x' ]; then pip install ${DJANGO_17}; fi"
52-
@sh -c "if [ '${DJANGO}' = 'dev' ]; then pip install ${DJANGO_DEV}; fi"
53-
@pip install coverage
54-
@python -c "from __future__ import print_function;import django;print('Django version:', django.get_version())"
55-
@echo "Database:" ${DBENGINE}
56-
$(MAKE) coverage
41+
coverage: mkbuilddir install-deps init-db
42+
echo ${PYTHONPATH};
43+
PYTHONPATH=${PWD}/tests/:${PWD} py.test tests -v --cov=concurrency --cov-report=html --cov-config=tests/.coveragerc -q
5744

5845

5946
clean:
@@ -62,10 +49,6 @@ clean:
6249
find concurrency/locale -name django.mo | xargs rm -f
6350

6451

65-
clonedigger: mkbuilddir
66-
-clonedigger concurrency -l python -o ${BUILDDIR}/clonedigger.html --fast
67-
68-
6952
docs: mkbuilddir
7053
mkdir -p ${BUILDDIR}/docs
7154
sphinx-build -aE docs/ ${BUILDDIR}/docs

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Django Concurrency
1212

1313
django-concurrency is an optimistic lock [1]_ implementation for Django.
1414

15-
Tested with: 1.4.x, 1.5.x, 1.6.x, 1.7 trunk.
15+
Tested with: 1.4.x, 1.5.x, 1.6.x, 1.7.x 1.8.x.
1616

1717
It prevents users from doing concurrent editing in Django both from UI and from a
1818
django command.
@@ -43,7 +43,7 @@ Similar projects
4343
Other projects that handle concurrent editing are `django-optimistic-lock`_ and `django-locking`_ anyway concurrency is "a batteries included" optimistic lock management system, here some features not available elsewhere:
4444

4545
* can be applied to any model; not only your code (ie. django.contrib.auth.Group)
46-
* works with django 1.4 and 1.5
46+
* works with django 1.4-1.8
4747
* handle `list-editable`_ ChangeList. (handle `#11313 <https://code.djangoproject.com/ticket/11313>`_)
4848
* manage concurrency conflicts in admin's actions
4949
* can intercept changes performend out of the django app (ie using pgAdmin, phpMyAdmin, Toads) (using `TriggerVersionField_`

concurrency/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import datetime
33
import os
44

5-
VERSION = __version__ = (0, 8, 1, 'final', 0)
5+
VERSION = __version__ = (0, 9, 0, 'final', 0)
66
__author__ = 'sax'
77

88

concurrency/admin.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def action_checkbox(self, obj):
4444
def get_confirmation_template(self):
4545
return "concurrency/delete_selected_confirmation.html"
4646

47-
def response_action(self, request, queryset):
47+
def response_action(self, request, queryset): # noqa
4848
"""
4949
Handle an admin action. This is called if a request is POSTed to the
5050
changelist; it returns an HttpResponse if the action was handled, and
@@ -93,7 +93,7 @@ def response_action(self, request, queryset):
9393

9494
if self.check_concurrent_action:
9595
self.delete_selected_confirmation_template = self.get_confirmation_template()
96-
96+
9797
# If select_across we have to avoid the use of concurrency
9898
if selected is not ALL:
9999
filters = []
@@ -114,8 +114,7 @@ def response_action(self, request, queryset):
114114
'The execution was aborted.')
115115
return HttpResponseRedirect(".")
116116
else:
117-
messages.warning(request, 'Selecting all records, you will avoid the concurrency check')
118-
117+
messages.warning(request, 'Selecting all records, you will avoid the concurrency check')
119118

120119
response = func(self, request, queryset)
121120

@@ -194,7 +193,7 @@ def save_model(self, request, obj, form, change):
194193
# If policy is set to 'silent' the user will be informed using message_user
195194
# raise Exception if not silent.
196195
# NOTE:
197-
# list_editable_policy MUST have the LIST_EDITABLE_POLICY_ABORT_ALL
196+
# list_editable_policy MUST have the LIST_EDITABLE_POLICY_ABORT_ALL
198197
# set to work properly
199198
if self.list_editable_policy == CONCURRENCY_LIST_EDITABLE_POLICY_ABORT_ALL:
200199
raise

0 commit comments

Comments
 (0)