Code

Ticket #8403: test.py

File test.py, 244 bytes (added by roman, 6 years ago)

Test using locking, run in two separate terminals, but in the same directory.

Line 
1#!/bin/env python
2from django.core.files import locks
3f = open('./file', 'wb')
4locks.lock(f, locks.LOCK_EX)
5f.write('Django')
6data = raw_input('more input for file, press return to write and close (releasing the lock)')
7f.write(data)
8f.close()