Get a string representation of this object. @param indent: The indent. @type indent: int @return: A string. @rtype: str
(self, indent=0, history=None)
| 425 | return collection |
| 426 | |
| 427 | def str(self, indent=0, history=None): |
| 428 | """ |
| 429 | Get a string representation of this object. |
| 430 | @param indent: The indent. |
| 431 | @type indent: int |
| 432 | @return: A string. |
| 433 | @rtype: str |
| 434 | """ |
| 435 | if history is None: |
| 436 | history = [] |
| 437 | if self in history: |
| 438 | return '%s ...' % Repr(self) |
| 439 | history.append(self) |
| 440 | tab = '%*s' % (indent * 3, '') |
| 441 | result = [] |
| 442 | result.append('%s<%s' % (tab, self.id)) |
| 443 | for n in self.description(): |
| 444 | if not hasattr(self, n): |
| 445 | continue |
| 446 | v = getattr(self, n) |
| 447 | if v is None: |
| 448 | continue |
| 449 | result.append(' %s="%s"' % (n, v)) |
| 450 | if len(self): |
| 451 | result.append('>') |
| 452 | for c in self.rawchildren: |
| 453 | result.append('\n') |
| 454 | result.append(c.str(indent+1, history[:])) |
| 455 | if c.isattr(): |
| 456 | result.append('@') |
| 457 | result.append('\n%s' % tab) |
| 458 | result.append('</%s>' % self.__class__.__name__) |
| 459 | else: |
| 460 | result.append(' />') |
| 461 | return ''.join(result) |
| 462 | |
| 463 | def description(self): |
| 464 | """ |
nothing calls this directly
no test coverage detected