module documentation

Portable file locking utilities.

Based partially on an example by Jonathan Feignberg in the Python Cookbook [1] (licensed under the Python Software License) and a ctypes port by Anatoly Techtonik for Roundup [2] (license [3]).

[1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203 [2] https://sourceforge.net/p/roundup/code/ci/default/tree/roundup/backends/portalocker.py [3] https://sourceforge.net/p/roundup/code/ci/default/tree/COPYING.txt

Example Usage:

>>> from django.core.files import locks
>>> with open('./file', 'wb') as f:
...     locks.lock(f, locks.LOCK_EX)
...     f.write('Django')
Constant LOCK​_EX Undocumented
Constant LOCK​_NB Undocumented
Constant LOCK​_SH Undocumented
Constant LPOVERLAPPED Undocumented
Class ​_OFFSET Undocumented
Class ​_OFFSET​_UNION Undocumented
Class OVERLAPPED Undocumented
Function ​_fd Get a filedescriptor from something which could be a file or an fd.
Function lock Undocumented
Function unlock Undocumented
LOCK_EX: int =

Undocumented

Value
2
LOCK_NB: int =

Undocumented

Value
1
LOCK_SH: int =

Undocumented

Value
0
LPOVERLAPPED =

Undocumented

Value
POINTER(OVERLAPPED)
def _fd(f):
Get a filedescriptor from something which could be a file or an fd.
def lock(f, flags):

Undocumented

def unlock(f):

Undocumented