Traverses the C{View} tree and prints its nodes. The nodes are printed converting them to string but other transformations can be specified by providing a method name as the C{transform} parameter. @type root: L{View} @param root: the root node from where t
(self, root="ROOT", indent="", transform=None, stream=sys.stdout)
| 3429 | return self.root |
| 3430 | |
| 3431 | def traverse(self, root="ROOT", indent="", transform=None, stream=sys.stdout): |
| 3432 | """ |
| 3433 | Traverses the C{View} tree and prints its nodes. |
| 3434 | |
| 3435 | The nodes are printed converting them to string but other transformations can be specified |
| 3436 | by providing a method name as the C{transform} parameter. |
| 3437 | |
| 3438 | @type root: L{View} |
| 3439 | @param root: the root node from where the traverse starts |
| 3440 | @type indent: str |
| 3441 | @param indent: the indentation string to use to print the nodes |
| 3442 | @type transform: method |
| 3443 | @param transform: a method to use to transform the node before is printed |
| 3444 | @param stream: the output stream |
| 3445 | """ |
| 3446 | |
| 3447 | if transform is None: |
| 3448 | # this cannot be a default value, otherwise |
| 3449 | # TypeError: 'staticmethod' object is not callable |
| 3450 | # is raised |
| 3451 | transform = ViewClient.TRAVERSE_CIT |
| 3452 | |
| 3453 | if root == "ROOT": |
| 3454 | root = self.root |
| 3455 | |
| 3456 | return ViewClient.__traverse(root, indent, transform, stream) |
| 3457 | |
| 3458 | @staticmethod |
| 3459 | def __traverse(root, indent="", transform=View.__str__, stream=sys.stdout): |