(node1, node2)
| 247 | |
| 248 | |
| 249 | def MergeAttributes(node1, node2): |
| 250 | # No attributes to merge? |
| 251 | if not node2.attributes: |
| 252 | return |
| 253 | |
| 254 | for name, value2 in node2.attributes.items(): |
| 255 | # Don't merge the 'Name' attribute. |
| 256 | if name == "Name": |
| 257 | continue |
| 258 | value1 = node1.getAttribute(name) |
| 259 | if value1: |
| 260 | # The attribute exist in the main node. If it's equal, we leave it |
| 261 | # untouched, otherwise we concatenate it. |
| 262 | if value1 != value2: |
| 263 | node1.setAttribute(name, ";".join([value1, value2])) |
| 264 | else: |
| 265 | # The attribute does not exist in the main node. We append this one. |
| 266 | node1.setAttribute(name, value2) |
| 267 | |
| 268 | # If the attribute was a property sheet attributes, we remove it, since |
| 269 | # they are useless. |
| 270 | if name == "InheritedPropertySheets": |
| 271 | node1.removeAttribute(name) |
| 272 | |
| 273 | |
| 274 | def MergeProperties(node1, node2): |
no test coverage detected