Преглед на файлове

HUE-5670 [doc2] Prevent exception when doc2 object is not linked to doc1

After upgrade to 5.8, some saved queries might end up without a link
to corresponding doc1 entries. This fix prevents failures by creating
doc1 links for such queries.
krish преди 8 години
родител
ревизия
b98e1dcee2
променени са 1 файла, в които са добавени 3 реда и са изтрити 2 реда
  1. 3 2
      desktop/libs/notebook/src/notebook/api.py

+ 3 - 2
desktop/libs/notebook/src/notebook/api.py

@@ -329,9 +329,10 @@ def _save_notebook(notebook, user):
   notebook['isHistory'] = False
   notebook['id'] = notebook_doc.id
 
-  if notebook_doc.doc is not None:
+  try:
     notebook_doc1 = notebook_doc.doc.get()
-  else:
+  except Exception, e:
+    LOG.error('Exception when retrieving document object for saved query: %s' % e)
     notebook_doc1 = Document.objects.link(
       notebook_doc,
       owner=notebook_doc.owner,