summaryrefslogtreecommitdiff
path: root/ishtar_common/libreoffice.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/libreoffice.py')
-rw-r--r--ishtar_common/libreoffice.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ishtar_common/libreoffice.py b/ishtar_common/libreoffice.py
index 7dbb36e30..3869ca81a 100644
--- a/ishtar_common/libreoffice.py
+++ b/ishtar_common/libreoffice.py
@@ -1,6 +1,5 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-
import time
import uno
@@ -9,14 +8,14 @@ from com.sun.star.beans import PropertyValue
from com.sun.star.connection import NoConnectException
from com.sun.star.sheet.ValidationType import LIST
-from com.sun.star.table import CellRangeAddress, CellAddress
+#from com.sun.star.table import CellRangeAddress, CellAddress
from ishtar_common.utils import num2col
from django.conf import settings
-RETRY = 1
+RETRY = 5
class UnoClient:
@@ -45,7 +44,7 @@ class UnoClient:
if self.remote_context and self.desktop:
return
try_nb = 0
- while not self.service_manager or try_nb > RETRY:
+ while not self.service_manager and try_nb <= RETRY:
self.connect()
try_nb += 1
if not self.service_manager:
@@ -64,6 +63,8 @@ class UnoClient:
def get_document(self, filename, propval=None):
self.create_context()
+ if not self.remote_context or not self.desktop:
+ return
url = "file://{}".format(filename)
if not propval:
propval = ()