Skip to content

Commit

Permalink
Merge branch 'release/0.7.1'
Browse files Browse the repository at this point in the history
* release/0.7.1:
  updates docs
  updates requirements of demoproject
  add python 3.3
  [requires.io] dependency update
  fixes minor typos in docs
  updates demo/requirements
  open 0.8
  [requires.io] dependency update
  • Loading branch information
saxix committed Apr 27, 2014
2 parents 921125e + dd31e66 commit 058aa7d
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 20 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -5,6 +5,7 @@ services:
python:
- 2.7
- 3.2
- 3.3

env:
- DJANGO="1.4.x" DBENGINE=mysql
Expand Down
8 changes: 6 additions & 2 deletions CHANGES
@@ -1,5 +1,9 @@
Release 0.7.0 (dev)
-------------------
Release 0.8
-----------


Release 0.7
-----------
* new :class:`concurrency.fields.TriggerVersionField`
* start using pytest
* moved tests outside main package
Expand Down
2 changes: 1 addition & 1 deletion concurrency/__init__.py
Expand Up @@ -2,7 +2,7 @@
import datetime
import os

VERSION = __version__ = (0, 7, 0, 'final', 0)
VERSION = __version__ = (0, 8, 0, 'alpha', 0)
__author__ = 'sax'


Expand Down
5 changes: 3 additions & 2 deletions demo/demoproject/requirements.pip
@@ -1,2 +1,3 @@
django-import-export==0.1.3
diff-match-patch==20120106
django-import-export==0.1.5
diff-match-patch==20121119
django-extensions
1 change: 1 addition & 0 deletions demo/demoproject/settings.py
Expand Up @@ -11,5 +11,6 @@
'django.contrib.admin',
'concurrency',
'demoproject.demoapp',
'django_extensions',
'tests']
# AUTHENTICATION_BACKENDS = ('demoproject.backends.AnyUserBackend',)
2 changes: 1 addition & 1 deletion docs/conf.py
Expand Up @@ -56,7 +56,7 @@
'django_issue': ('https://code.djangoproject.com/ticket/%s', 'issue #'),

}
next_version = '0.8'
next_version = '0.9'
todo_include_todos = True

# Add any paths that contain templates here, relative to this directory.
Expand Down
31 changes: 18 additions & 13 deletions docs/index.rst
Expand Up @@ -46,36 +46,40 @@ Overview
* works with `South`_ and `diango-reversion`_
* Admin integration. Handle :ref:`actions <admin_action>` and :ref:`list_editable <list_editable>` (solves :django_issue:`11313`)
* can handle external updates (see :class:`TriggerVersionField`)
Todo
====

- intercept external updates
(ie changes done using DB browser like SQLDeveloper, pgAdmin, phpMyAdmin...)

.. _protocols:

How it works
============

|concurrency| works adding a :class:`concurrency.fields.VersionField` to each model, each time a record is saved
the version number changes (the algorithm used depends on the implementation of
:class:`concurrency.fields.VersionField` used (see :ref:`fields`).

Overview
--------

|concurrency| works adding a :class:`concurrency.fields.VersionField` to each model,
each time a record is saved the version number changes (the algorithm used depends
on the implementation of :class:`concurrency.fields.VersionField` used (see :ref:`fields`).


|concurrency| use two different way to manage concurrent updates:


Protocols
---------

django 1.4 - 1.5
----------------
~~~~~~~~~~~~~~~~

When a record is saved, |concurrency| tries to get a lock on the record based on the old revision
number, if the record is not found a :ref:`RecordModifiedError` is raised.
The lock is obtained using ``SELECT FOR UPDATE`` and it's requirend
to prevent other updates during the internal django ``save()`` execution.

django >= 1.6
-----------------
~~~~~~~~~~~~~

Full implementation of ``optimistic-lock`` pattern using a SQL clause like:
Full implementation of ``optimistic-lock`` pattern using a SQL clause like:

.. code-block:: sql
Expand All @@ -85,14 +89,15 @@ Full implementation of ``optimistic-lock`` pattern using a SQL clause like:
.. _2_protocols:

Why two protocols ?
-------------------
The initial implementation of |concurrency| used the real pattern [1],
~~~~~~~~~~~~~~~~~~~

The initial implementation of |concurrency| used the real pattern [1]_,
but it required a partial rewrite of original Django's code and it was
very hard to maintain/keep updated, for this reason starting from version 0.3,
:ref:`select_for_update()` was used.

With the new implementation (django 1.6) the optimistic lock pattern it
is easier to implement, starting from version 0.7 C uses different implementation
is easier to implement, starting from version 0.7 |concurrency| uses different implementation
depending on the django version used.

.. note:: From 1.0 support for django < 1.6 will be drooped
Expand Down
7 changes: 6 additions & 1 deletion tox.ini
@@ -1,6 +1,6 @@
[tox]
envlist =
d14,d15,d16,trunk,py32stable
d14,d15,d16,trunk,py32stable,py33stable

[pytest]
norecursedirs = data .tox concurrency
Expand Down Expand Up @@ -64,3 +64,8 @@ setenv =
basepython = python3.2
setenv =
DJANGO=1.6.x

[testenv:py33stable]
basepython = python3.3
setenv =
DJANGO=1.6.x

0 comments on commit 058aa7d

Please sign in to comment.