Added a "replace" method to lockhandler, courtesy of patch by user Shell.
This commit is contained in:
parent
a4adc035f2
commit
049cc84be7
1 changed files with 11 additions and 1 deletions
|
|
@ -290,6 +290,16 @@ class LockHandler(object):
|
||||||
self.log_obj = None
|
self.log_obj = None
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def replace(self, lockstring, log_obj=None):
|
||||||
|
"Replaces the lockstring entirely."
|
||||||
|
old_lockstring = str(self)
|
||||||
|
self.clear()
|
||||||
|
try:
|
||||||
|
return self.add(lockstring, log_obj)
|
||||||
|
except LockException:
|
||||||
|
self.add(old_lockstring, log_obj)
|
||||||
|
raise
|
||||||
|
|
||||||
def get(self, access_type):
|
def get(self, access_type):
|
||||||
"get the lockstring of a particular type"
|
"get the lockstring of a particular type"
|
||||||
return self.locks.get(access_type, None)
|
return self.locks.get(access_type, None)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue