Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5diff
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
erp5diff
Commits
c9ecea0b
Commit
c9ecea0b
authored
May 21, 2010
by
Nicolas Delaby
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix relative calculation of position for xupdate:insert-before nodes
parent
87e4471c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
+3
-3
ERP5Diff.py
ERP5Diff.py
+3
-3
No files found.
ERP5Diff.py
View file @
c9ecea0b
...
@@ -235,7 +235,7 @@ class ERP5Diff:
...
@@ -235,7 +235,7 @@ class ERP5Diff:
append_element
=
last_append_element
append_element
=
last_append_element
elif
relative_next
is
not
None
and
relative_next
not
in
element_list
:
elif
relative_next
is
not
None
and
relative_next
not
in
element_list
:
append_element
=
etree
.
SubElement
(
root
,
'{%s}insert-before'
%
self
.
_ns
,
nsmap
=
element
.
nsmap
)
append_element
=
etree
.
SubElement
(
root
,
'{%s}insert-before'
%
self
.
_ns
,
nsmap
=
element
.
nsmap
)
path_list
=
self
.
_makeRelativePathList
([
relative_next
])
path_list
=
self
.
_makeRelativePathList
([
relative_next
]
,
before
=
1
)
next_sibling_path
=
self
.
_concatPath
(
path
,
path_list
[
0
])
next_sibling_path
=
self
.
_concatPath
(
path
,
path_list
[
0
])
append_element
.
attrib
[
'select'
]
=
next_sibling_path
append_element
.
attrib
[
'select'
]
=
next_sibling_path
elif
relative_previous
is
not
None
and
relative_previous
not
in
element_list
:
elif
relative_previous
is
not
None
and
relative_previous
not
in
element_list
:
...
@@ -400,7 +400,7 @@ class ERP5Diff:
...
@@ -400,7 +400,7 @@ class ERP5Diff:
return
True
return
True
return
False
return
False
def
_makeRelativePathList
(
self
,
element_list
):
def
_makeRelativePathList
(
self
,
element_list
,
before
=
0
):
"""
"""
Make a list of relative paths from a list of elements.
Make a list of relative paths from a list of elements.
"""
"""
...
@@ -429,7 +429,7 @@ class ERP5Diff:
...
@@ -429,7 +429,7 @@ class ERP5Diff:
len_all_similar_sibling
=
len
(
element
.
findall
(
'../%s'
%
element
.
tag
))
len_all_similar_sibling
=
len
(
element
.
findall
(
'../%s'
%
element
.
tag
))
if
len_all_similar_sibling
>
1
:
if
len_all_similar_sibling
>
1
:
position
=
len_all_similar_sibling
-
len
(
list
(
element
.
itersiblings
(
tag
=
element
.
tag
)))
position
=
len_all_similar_sibling
-
len
(
list
(
element
.
itersiblings
(
tag
=
element
.
tag
)))
path_list
.
append
(
'%s[%d]'
%
(
element
.
xpath
(
'name()'
),
position
))
path_list
.
append
(
'%s[%d]'
%
(
element
.
xpath
(
'name()'
),
position
-
before
))
else
:
else
:
path_list
.
append
(
element
.
xpath
(
'name()'
))
path_list
.
append
(
element
.
xpath
(
'name()'
))
...
...
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