瀏覽代碼

HUE-2273 [desktop] Blacklisting apps with existing document will break home page

Romain Rigaux 11 年之前
父節點
當前提交
dea2f87
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      desktop/core/src/desktop/api.py

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

@@ -132,6 +132,11 @@ def massaged_documents_for_json(documents, user):
   docs = {}
 
   for document in documents:
+    try:
+      url = document.content_object.get_absolute_url()
+    except:
+      # If app of document is disabled
+      url = ''
     read_perms = document.list_permissions(perm='read')
     write_perms = document.list_permissions(perm='write')
     docs[document.id] = {
@@ -139,7 +144,7 @@ def massaged_documents_for_json(documents, user):
       'contentType': document.content_type.name,
       'icon': document.icon,
       'name': document.name,
-      'url': document.content_object.get_absolute_url(),
+      'url': url,
       'description': document.description,
       'tags': [{'id': tag.id, 'name': tag.tag} for tag in document.tags.all()],
       'perms': {