Explorar o código

HUE-5075 [core] Call get_absolute_url() only when document content object has the attribute

krish %!s(int64=9) %!d(string=hai) anos
pai
achega
59a32fa
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      desktop/core/src/desktop/api.py

+ 1 - 1
desktop/core/src/desktop/api.py

@@ -179,7 +179,7 @@ def massaged_documents_for_json(documents, user):
 
   for document in documents:
     try:
-      url = document.content_object.get_absolute_url()
+      url = document.content_object and hasattr(document.content_object, 'get_absolute_url') and document.content_object.get_absolute_url() or ''
     except:
       LOG.exception('failed to get absolute url')
       # If app of document is disabled