Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
cloudooo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
cloudooo
Commits
27d76c56
Commit
27d76c56
authored
Apr 11, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: use zope.interface's implementer decorator
this will be compatible with python3
parent
b2bf7ce9
Pipeline
#28115
passed with stage
in 0 seconds
Changes
14
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
29 additions
and
39 deletions
+29
-39
cloudooo/file.py
cloudooo/file.py
+2
-2
cloudooo/handler/ffmpeg/handler.py
cloudooo/handler/ffmpeg/handler.py
+2
-3
cloudooo/handler/imagemagick/handler.py
cloudooo/handler/imagemagick/handler.py
+2
-3
cloudooo/handler/ooo/application/application.py
cloudooo/handler/ooo/application/application.py
+2
-3
cloudooo/handler/ooo/application/openoffice.py
cloudooo/handler/ooo/application/openoffice.py
+2
-3
cloudooo/handler/ooo/document.py
cloudooo/handler/ooo/document.py
+2
-3
cloudooo/handler/ooo/filter.py
cloudooo/handler/ooo/filter.py
+2
-3
cloudooo/handler/ooo/handler.py
cloudooo/handler/ooo/handler.py
+2
-2
cloudooo/handler/ooo/mimemapper.py
cloudooo/handler/ooo/mimemapper.py
+2
-2
cloudooo/handler/ooo/monitor/monitor.py
cloudooo/handler/ooo/monitor/monitor.py
+2
-3
cloudooo/handler/pdf/handler.py
cloudooo/handler/pdf/handler.py
+2
-3
cloudooo/handler/wkhtmltopdf/handler.py
cloudooo/handler/wkhtmltopdf/handler.py
+2
-3
cloudooo/handler/x2t/handler.py
cloudooo/handler/x2t/handler.py
+2
-3
cloudooo/manager.py
cloudooo/manager.py
+3
-3
No files found.
cloudooo/file.py
View file @
27d76c56
...
...
@@ -32,17 +32,17 @@ import mimetypes
import
tempfile
from
os.path
import
join
,
exists
,
curdir
,
abspath
from
os
import
listdir
,
remove
,
chdir
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
zipfile
import
ZipFile
,
is_zipfile
from
shutil
import
rmtree
from
cloudooo.interfaces.file
import
IFile
@
implementer
(
IFile
)
class
File
(
object
):
"""File is used to manipulate one temporary file
stored into the filesystem.
"""
implements
(
IFile
)
def
__init__
(
self
,
base_folder_url
,
data
,
source_format
):
"""Create an file into file system and store the URL.
...
...
cloudooo/handler/ffmpeg/handler.py
View file @
27d76c56
...
...
@@ -28,18 +28,17 @@
#
##############################################################################
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.handler
import
IHandler
from
cloudooo.file
import
File
from
cloudooo.util
import
logger
from
subprocess
import
Popen
,
PIPE
from
tempfile
import
mktemp
@
implementer
(
IHandler
)
class
Handler
(
object
):
"""FFMPEG Handler is used to handler inputed audio and video files"""
implements
(
IHandler
)
def
__init__
(
self
,
base_folder_url
,
data
,
source_format
,
**
kw
):
"""
base_folder_url(string)
...
...
cloudooo/handler/imagemagick/handler.py
View file @
27d76c56
...
...
@@ -29,7 +29,7 @@
##############################################################################
import
re
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.handler
import
IHandler
from
cloudooo.file
import
File
from
cloudooo.util
import
logger
...
...
@@ -37,11 +37,10 @@ from subprocess import Popen, PIPE
from
tempfile
import
mktemp
@
implementer
(
IHandler
)
class
Handler
(
object
):
"""ImageMagic Handler is used to handler images."""
implements
(
IHandler
)
def
__init__
(
self
,
base_folder_url
,
data
,
source_format
,
**
kw
):
""" Load pdf document """
self
.
base_folder_url
=
base_folder_url
...
...
cloudooo/handler/ooo/application/application.py
View file @
27d76c56
...
...
@@ -28,19 +28,18 @@
#
##############################################################################
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.application
import
IApplication
from
cloudooo.util
import
logger
from
cloudooo.handler.ooo.util
import
waitStopDaemon
from
psutil
import
pid_exists
,
Process
,
AccessDenied
@
implementer
(
IApplication
)
class
Application
(
object
):
"""Base object to create an object that is possible manipulation a
process"""
implements
(
IApplication
)
name
=
"application"
def
start
(
self
,
init
=
True
):
...
...
cloudooo/handler/ooo/application/openoffice.py
View file @
27d76c56
...
...
@@ -34,7 +34,7 @@ import subprocess
from
psutil
import
AccessDenied
,
NoSuchProcess
from
os.path
import
exists
,
join
from
threading
import
Lock
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
application
import
Application
from
cloudooo.interfaces.lockable
import
ILockable
from
cloudooo.util
import
logger
...
...
@@ -43,11 +43,10 @@ from cloudooo.handler.ooo.util import waitStartDaemon, \
socketStatus
@
implementer
(
ILockable
)
class
OpenOffice
(
Application
):
"""Object to control one OOo Instance and all features instance."""
implements
(
ILockable
)
name
=
"openoffice"
def
__init__
(
self
):
...
...
cloudooo/handler/ooo/document.py
View file @
27d76c56
...
...
@@ -28,7 +28,7 @@
#
##############################################################################
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
zipfile
import
ZipFile
from
StringIO
import
StringIO
from
lxml
import
etree
...
...
@@ -40,11 +40,10 @@ class FileSystemDocument(File):
pass
@
implementer
(
IOdfDocument
)
class
OdfDocument
(
object
):
"""Manipulates odf documents in memory"""
implements
(
IOdfDocument
)
def
__init__
(
self
,
data
,
source_format
):
"""Open the the file in memory.
...
...
cloudooo/handler/ooo/filter.py
View file @
27d76c56
...
...
@@ -28,15 +28,14 @@
#
##############################################################################
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.filter
import
IFilter
@
implementer
(
IFilter
)
class
Filter
(
object
):
"""Filter of OOo."""
implements
(
IFilter
)
def
__init__
(
self
,
extension
,
filter
,
mimetype
,
document_service
,
**
kwargs
):
"""Receives extension, filter and mimetype of filter and saves in object.
"""
...
...
cloudooo/handler/ooo/handler.py
View file @
27d76c56
...
...
@@ -35,7 +35,7 @@ from base64 import decodestring, encodestring
from
os
import
environ
,
path
from
subprocess
import
Popen
,
PIPE
from
cloudooo.handler.ooo.application.openoffice
import
openoffice
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.handler
import
IHandler
from
cloudooo.handler.ooo.mimemapper
import
mimemapper
from
cloudooo.handler.ooo.document
import
FileSystemDocument
...
...
@@ -45,13 +45,13 @@ from cloudooo.util import logger, parseContentType, loadMimetypeList
from
psutil
import
pid_exists
@
implementer
(
IHandler
)
class
Handler
(
object
):
"""OOO Handler is used to access the one Document and OpenOffice.
For each Document inputed is created on instance of this class to manipulate
the document. This Document must be able to create and remove a temporary
document at FS, load and export.
"""
implements
(
IHandler
)
enable_scripting
=
False
...
...
cloudooo/handler/ooo/mimemapper.py
View file @
27d76c56
...
...
@@ -32,7 +32,7 @@ import pkg_resources
from
re
import
findall
from
subprocess
import
Popen
,
PIPE
from
subprocess
import
STDOUT
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
filter
import
Filter
from
os
import
environ
,
path
from
cloudooo.interfaces.mimemapper
import
IMimemapper
...
...
@@ -40,11 +40,11 @@ from types import InstanceType
import
json
@
implementer
(
IMimemapper
)
class
MimeMapper
(
object
):
"""Load all filters from OOo. You can get the filter you want or all
filters of the specific extension.
"""
implements
(
IMimemapper
)
def
__init__
(
self
):
"""When it is instantiated, it creates a structure to store filters.
...
...
cloudooo/handler/ooo/monitor/monitor.py
View file @
27d76c56
...
...
@@ -28,15 +28,14 @@
#
##############################################################################
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.monitor
import
IMonitor
@
implementer
(
IMonitor
)
class
Monitor
(
object
):
""" """
implements
(
IMonitor
)
def
__init__
(
self
,
openoffice
,
interval
):
"""Expects an openoffice object and the interval"""
self
.
status_flag
=
False
...
...
cloudooo/handler/pdf/handler.py
View file @
27d76c56
...
...
@@ -29,7 +29,7 @@
##############################################################################
import
io
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.handler
import
IHandler
from
cloudooo.file
import
File
from
cloudooo.util
import
logger
,
parseContentType
...
...
@@ -39,11 +39,10 @@ from tempfile import mktemp
from
pyPdf
import
PdfFileWriter
,
PdfFileReader
from
pyPdf.generic
import
NameObject
,
createStringObject
@
implementer
(
IHandler
)
class
Handler
(
object
):
"""PDF Handler is used to handler inputed pdf document."""
implements
(
IHandler
)
def
__init__
(
self
,
base_folder_url
,
data
,
source_format
,
**
kw
):
""" Load pdf document """
self
.
base_folder_url
=
base_folder_url
...
...
cloudooo/handler/wkhtmltopdf/handler.py
View file @
27d76c56
...
...
@@ -27,7 +27,7 @@
#
##############################################################################
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.handler
import
IHandler
from
cloudooo.file
import
File
from
cloudooo.util
import
logger
,
parseContentType
...
...
@@ -39,11 +39,10 @@ from base64 import b64decode
def
keyNameToOption
(
key_name
,
prefix
=
""
):
return
"--"
+
prefix
+
key_name
.
replace
(
"_"
,
"-"
)
@
implementer
(
IHandler
)
class
Handler
(
object
):
"""ImageMagic Handler is used to handler images."""
implements
(
IHandler
)
def
__init__
(
self
,
base_folder_url
,
data
,
source_format
,
**
kw
):
""" Load pdf document """
self
.
base_folder_url
=
base_folder_url
...
...
cloudooo/handler/x2t/handler.py
View file @
27d76c56
...
...
@@ -34,7 +34,7 @@ import json
import
io
from
mimetypes
import
guess_type
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
cloudooo.interfaces.handler
import
IHandler
from
cloudooo.file
import
File
...
...
@@ -156,14 +156,13 @@ yformat_map = {
yformat_tuple
=
(
"docy"
,
"xlsy"
,
"ppty"
)
@
implementer
(
IHandler
)
class
Handler
(
object
):
"""
X2T Handler is used to convert Microsoft Office 2007 documents to OnlyOffice
documents.
"""
implements
(
IHandler
)
def
__init__
(
self
,
base_folder_url
,
data
,
source_format
,
**
kw
):
"""
base_folder_url(string)
...
...
cloudooo/manager.py
View file @
27d76c56
...
...
@@ -32,7 +32,7 @@
import
mimetypes
from
mimetypes
import
guess_type
,
guess_extension
from
base64
import
encodestring
,
decodestring
from
zope.interface
import
implement
s
from
zope.interface
import
implement
er
from
interfaces.manager
import
IManager
,
IERP5Compatibility
from
cloudooo.util
import
logger
,
parseContentType
from
cloudooo.interfaces.granulate
import
ITableGranulator
...
...
@@ -94,10 +94,10 @@ def BBB_guess_extension(mimetype, title=None):
"image/jpeg"
:
".jpg"
,
}.
get
(
parseContentType
(
mimetype
).
gettype
(),
None
)
or
guess_extension
(
mimetype
)
@
implementer
(
IManager
,
IERP5Compatibility
,
ITableGranulator
,
IImageGranulator
,
ITextGranulator
)
class
Manager
(
object
):
"""Manipulates requisitons of client and temporary files in file system."""
implements
(
IManager
,
IERP5Compatibility
,
ITableGranulator
,
IImageGranulator
,
ITextGranulator
)
def
__init__
(
self
,
path_tmp_dir
,
**
kw
):
"""Need pass the path where the temporary document will be created."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment