Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xueyun Qian
erp5
Commits
7f704c1e
Commit
7f704c1e
authored
Apr 17, 2013
by
Jérome Perrin
Browse files
Options
Browse Files
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
:
...
...
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'
)
...
...
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