fix: prevent NonAuthorizedOperationError to kill the right managment timer

This commit is contained in:
Swann
2020-10-14 00:36:59 +02:00
parent 9dd02b2756
commit 753f4d3f27

View File

@ -40,7 +40,7 @@ from replication.constants import (FETCHED,
REPARENT) REPARENT)
from replication.interface import session from replication.interface import session
from replication.exception import NonAuthorizedOperationError
class Delayable(): class Delayable():
"""Delayable task interface """Delayable task interface
@ -167,10 +167,13 @@ class DynamicRightSelectTimer(Timer):
recursive = True recursive = True
if node.data and 'instance_type' in node.data.keys(): if node.data and 'instance_type' in node.data.keys():
recursive = node.data['instance_type'] != 'COLLECTION' recursive = node.data['instance_type'] != 'COLLECTION'
try:
session.change_owner( session.change_owner(
node.uuid, node.uuid,
RP_COMMON, RP_COMMON,
recursive=recursive) recursive=recursive)
except NonAuthorizedOperationError:
logging.warning(f"Not authorized to change {node} owner")
# change new selection to our # change new selection to our
for obj in obj_ours: for obj in obj_ours:
@ -181,10 +184,13 @@ class DynamicRightSelectTimer(Timer):
if node.data and 'instance_type' in node.data.keys(): if node.data and 'instance_type' in node.data.keys():
recursive = node.data['instance_type'] != 'COLLECTION' recursive = node.data['instance_type'] != 'COLLECTION'
try:
session.change_owner( session.change_owner(
node.uuid, node.uuid,
settings.username, settings.username,
recursive=recursive) recursive=recursive)
except NonAuthorizedOperationError:
logging.warning(f"Not authorized to change {node} owner")
else: else:
return return
@ -203,11 +209,13 @@ class DynamicRightSelectTimer(Timer):
filter_owner=settings.username) filter_owner=settings.username)
for key in owned_keys: for key in owned_keys:
node = session.get(uuid=key) node = session.get(uuid=key)
try:
session.change_owner( session.change_owner(
key, key,
RP_COMMON, RP_COMMON,
recursive=recursive) recursive=recursive)
except NonAuthorizedOperationError:
logging.warning(f"Not authorized to change {key} owner")
for obj in bpy.data.objects: for obj in bpy.data.objects:
object_uuid = getattr(obj, 'uuid', None) object_uuid = getattr(obj, 'uuid', None)