Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Frederic Thoma
erp5
Commits
7f704c1e
Commit
7f704c1e
authored
11 years ago
by
Jérome Perrin
Browse files
Options
Download
Email Patches
Plain Diff
PDF: don't fail getting content information when pdf is empty
parent
ad84c4fa
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
product/ERP5/Document/PDFDocument.py
product/ERP5/Document/PDFDocument.py
+3
-6
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+6
-0
No files found.
product/ERP5/Document/PDFDocument.py
View file @
7f704c1e
...
...
@@ -234,13 +234,10 @@ class PDFDocument(Image):
security
.
declareProtected
(
Permissions
.
AccessContentsInformation
,
'getContentInformation'
)
def
getContentInformation
(
self
):
"""Returns the information about the PDF document with pdfinfo.
"""
Returns the information about the PDF document with
pdfinfo.
NOTE: XXX check that command exists and was executed
successfully
"""
if
not
self
.
hasData
():
return
dict
()
try
:
return
self
.
_content_information
.
copy
()
except
AttributeError
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5OOo/tests/testDms.py
View file @
7f704c1e
...
...
@@ -1323,6 +1323,12 @@ class TestDocument(TestDocumentMixin):
content_information
=
document
.
getContentInformation
()
self
.
assertEquals
(
'1'
,
content_information
[
'Pages'
])
def
test_empty_PDF_content_information
(
self
):
document
=
self
.
portal
.
document_module
.
newContent
(
portal_type
=
'PDF'
)
content_information
=
document
.
getContentInformation
()
# empty PDF have no content information
self
.
assertEquals
(
dict
(),
content_information
)
def
test_PDF_content_content_type
(
self
):
upload_file
=
makeFileUpload
(
'REF-en-001.pdf'
)
document
=
self
.
portal
.
document_module
.
newContent
(
portal_type
=
'PDF'
)
...
...
This diff is collapsed.
Click to expand it.
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