def get_lock(self): # Lock info name = data.get_lock_code() if name != None: self._response_plain( name) else: self._response_not_found( RESPONSE_NOT_LOCKED)
def get_lock(self): # Lock info name = data.get_lock_code() if name != None: self._response_plain(name) else: self._response_not_found(RESPONSE_NOT_LOCKED)
def check_update(self, blocks, not_found=False): """ Checks that update is allowed - the lock is acquired and specified in URL. """ resp = self._response_forbidden if not_found: resp = self._response_not_found # Ignore update if the lock is not acquired if len(blocks) == 0: return self._response_not_found() # Update does not exist if there is no lock lock_code = data.get_lock_code() if lock_code is None: return resp( RESPONSE_NOT_LOCKED) # Check that the lock is correct if blocks[0] != lock_code: return resp( RESPONSE_INV_LOCK_CODE) return False
def check_update(self, blocks, not_found=False): """ Checks that update is allowed - the lock is acquired and specified in URL. """ resp = self._response_forbidden if not_found: resp = self._response_not_found # Ignore update if the lock is not acquired if len(blocks) == 0: return self._response_not_found() # Update does not exist if there is no lock lock_code = data.get_lock_code() if lock_code is None: return resp(RESPONSE_NOT_LOCKED) # Check that the lock is correct if blocks[0] != lock_code: return resp(RESPONSE_INV_LOCK_CODE) return False