Answers the first element in the offspring list that fits the name. Answers None if it cannot be found. Note that the result of the search depends on where in the tree self is. If self.isPage there probably is a different set of elements found than searching witn sel
(self, name)
| 677 | return None |
| 678 | |
| 679 | def getElementByName(self, name): |
| 680 | """Answers the first element in the offspring list that fits the name. |
| 681 | Answers None if it cannot be found. |
| 682 | |
| 683 | Note that the result of the search depends on where in the tree self is. |
| 684 | If self.isPage there probably is a different set of elements found than |
| 685 | searching witn self as arbitrary Element instance. |
| 686 | |
| 687 | >>> e1 = Element(name='Deeper') |
| 688 | >>> e2 = Element(name='Deeper') |
| 689 | >>> e3 = Element(name='Child', elements=[e1, e2]) |
| 690 | >>> e = Element(name='Parent', elements=[e3]) |
| 691 | >>> # Get child element by its name |
| 692 | >>> child = e.get('Child') |
| 693 | >>> child is e3 |
| 694 | True |
| 695 | >>> # Find first down the list |
| 696 | >>> e.get('Deeper') is e1, e.get('Deeper') is e2 |
| 697 | (True, False) |
| 698 | """ |
| 699 | if self.name == name: |
| 700 | return self |
| 701 | for e in self.elements: |
| 702 | # Don't search on next page yet. |
| 703 | found = e.getElementByName(name) |
| 704 | if found is not None: |
| 705 | return found |
| 706 | return None |
| 707 | |
| 708 | # D R A W B O T / F L A T S U P P O R T |
| 709 |
no outgoing calls
no test coverage detected