Added random named pipe support to the OfficeConverter pipe method
This commit is contained in:
@@ -3,6 +3,8 @@ import os
|
||||
import re
|
||||
import types
|
||||
import tempfile
|
||||
import string
|
||||
import random
|
||||
|
||||
from django.utils.http import urlquote as django_urlquote
|
||||
from django.utils.http import urlencode as django_urlencode
|
||||
@@ -358,8 +360,13 @@ def validate_path(path):
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def encapsulate(function):
|
||||
# Workaround Django ticket 15791
|
||||
# Changeset 16045
|
||||
# http://stackoverflow.com/questions/6861601/cannot-resolve-callable-context-variable/6955045#6955045
|
||||
return lambda: function
|
||||
|
||||
|
||||
def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
|
||||
return ''.join(random.choice(chars) for x in range(size))
|
||||
|
||||
@@ -3,6 +3,7 @@ import subprocess
|
||||
|
||||
from mimetype.api import get_mimetype
|
||||
from common.conf.settings import TEMPORARY_DIRECTORY
|
||||
from common.utils import id_generator
|
||||
|
||||
from converter.conf.settings import UNOCONV_PATH, UNOCONV_USE_PIPE
|
||||
from converter.exceptions import (OfficeConversionError,
|
||||
@@ -89,7 +90,7 @@ class OfficeConverterBackendUnoconv(object):
|
||||
|
||||
if UNOCONV_USE_PIPE:
|
||||
command.append(u'--pipe')
|
||||
command.append(u'mayan')
|
||||
command.append(u'mayan-%s' % id_generator())
|
||||
|
||||
command.append(u'--format=pdf')
|
||||
command.append(u'--output=%s' % self.output_filepath)
|
||||
|
||||
Reference in New Issue
Block a user