Get the I{virtual footprint} of the object. This is really a count of the attributes in the branch with a significant value. @param sobject: A suds object. @type sobject: L{Object} @return: The branch footprint. @rtype: int
(sobject)
| 69 | |
| 70 | |
| 71 | def footprint(sobject): |
| 72 | """ |
| 73 | Get the I{virtual footprint} of the object. |
| 74 | This is really a count of the attributes in the branch with a significant |
| 75 | value. |
| 76 | @param sobject: A suds object. |
| 77 | @type sobject: L{Object} |
| 78 | @return: The branch footprint. |
| 79 | @rtype: int |
| 80 | """ |
| 81 | n = 0 |
| 82 | for a in sobject.__keylist__: |
| 83 | v = getattr(sobject, a) |
| 84 | if v is None: |
| 85 | continue |
| 86 | if isinstance(v, Object): |
| 87 | n += footprint(v) |
| 88 | continue |
| 89 | if hasattr(v, '__len__'): |
| 90 | if len(v): |
| 91 | n += 1 |
| 92 | continue |
| 93 | n += 1 |
| 94 | return n |
| 95 | |
| 96 | |
| 97 | class Factory: |