def match_correspondents(document, classifier, user=None):
pred_id = classifier.predict_correspondent(document.content) if classifier else None
+ if user is None and document.owner is not None:
+ user = document.owner
+
if user is not None:
correspondents = get_objects_for_user_owner_aware(
user,
def match_document_types(document, classifier, user=None):
pred_id = classifier.predict_document_type(document.content) if classifier else None
+ if user is None and document.owner is not None:
+ user = document.owner
+
if user is not None:
document_types = get_objects_for_user_owner_aware(
user,
def match_tags(document, classifier, user=None):
predicted_tag_ids = classifier.predict_tags(document.content) if classifier else []
+ if user is None and document.owner is not None:
+ user = document.owner
+
if user is not None:
tags = get_objects_for_user_owner_aware(user, "documents.view_tag", Tag)
else:
def match_storage_paths(document, classifier, user=None):
pred_id = classifier.predict_storage_path(document.content) if classifier else None
+ if user is None and document.owner is not None:
+ user = document.owner
+
if user is not None:
storage_paths = get_objects_for_user_owner_aware(
user,