Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5_workflow
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wenjie.zheng
erp5_workflow
Commits
fc016de0
Commit
fc016de0
authored
Oct 24, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify code a bit.
parent
55364f3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
product/ERP5OOo/OOoUtils.py
product/ERP5OOo/OOoUtils.py
+7
-15
No files found.
product/ERP5OOo/OOoUtils.py
View file @
fc016de0
...
...
@@ -269,7 +269,7 @@ class OOoParser(Implicit):
"""
Return a dictionnary of all pictures in the document
"""
if
len
(
self
.
pictures
)
<=
0
:
if
not
self
.
pictures
:
for
file_name
in
self
.
oo_files
:
raw_data
=
self
.
oo_files
[
file_name
]
pict_type
=
imghdr
.
what
(
None
,
raw_data
)
...
...
@@ -498,13 +498,7 @@ class OOoParser(Implicit):
"""
Get table dimension as dictionnary contain both height and width
"""
max_cols
=
0
for
line_index
in
range
(
len
(
table
)):
line
=
table
[
line_index
]
if
len
(
line
)
>
max_cols
:
max_cols
=
len
(
line
)
return
{
'width'
:
max_cols
return
{
'width'
:
max
(
len
(
x
)
for
x
in
table
)
,
'height'
:
len
(
table
)
}
...
...
@@ -512,11 +506,9 @@ class OOoParser(Implicit):
"""
Add necessary cells and lines to obtain given bounds
"""
while
height
>
len
(
table
):
table
.
append
([])
for
line
in
range
(
height
):
while
width
>
len
(
table
[
line
]):
table
[
line
].
append
(
None
)
table
+=
[[]]
*
(
len
(
table
)
-
height
)
for
line
in
table
:
line
+=
[
None
]
*
(
len
(
line
)
-
width
)
return
table
def
_getTableListUnion
(
self
,
list1
,
list2
):
...
...
@@ -526,10 +518,10 @@ class OOoParser(Implicit):
several embedded spreadsheets with the same id. This explain the
use of random suffix in such extreme case.
"""
for
list2_key
in
list2
.
keys
()
:
for
list2_key
in
list2
:
# Generate a new table ID if needed
new_key
=
list2_key
while
new_key
in
list1
.
keys
()
:
while
new_key
in
list1
:
new_key
=
list2_key
+
'_'
+
str
(
random
.
randint
(
1000
,
9999
))
list1
[
new_key
]
=
list2
[
list2_key
]
return
list1
...
...
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