components.lock.models¶
Lock model
-
class
components.lock.models.DatabaseLockObject(*args, **kwargs)¶ Bases:
django_mongoengine.document.DjangoFlavor,mongoengine.document.DocumentClass DatabaseLockObject.
-
exception
DoesNotExist¶ Bases:
mongoengine.errors.DoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
mongoengine.errors.MultipleObjectsReturned
-
static
get_lock_by_object(object)¶ Get lock relative to the given object.
Parameters: object – Returns:
-
id¶ A field wrapper around MongoDB’s ObjectIds.
-
lock_date¶
-
object¶
-
user_id¶
-
exception
-
class
components.lock.models.Lock¶ Class Lock. Singleton thread safe. Only this object should be called to be used for an action regarding locking a Document.
-
classmethod
acquire()¶
-
get_object_locked(object)¶ Get the locked object.
Parameters: object – Returns:
-
classmethod
release()¶
-
remove_lock(database_lock_object)¶ Remove a lock.
Parameters: database_lock_object – Returns:
-
set_lock(object, user)¶ Set lock on a Document.
Parameters: - object –
- user –
Returns:
-
classmethod