diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2009-08-11 15:17:18 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2009-08-11 15:17:18 +0000 |
| commit | e211cfe033e2c6653b30f3f485cc0084063bfb2a (patch) | |
| tree | 3cfa932f97f4855ba956c38211d6ec50e3ee1cac /qpid/python/mllib | |
| parent | 026fff8aca48039b585b2069d470f90e1fb1ff38 (diff) | |
| download | qpid-python-e211cfe033e2c6653b30f3f485cc0084063bfb2a.tar.gz | |
added support for setting attributes
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@803150 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python/mllib')
| -rw-r--r-- | qpid/python/mllib/dom.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/qpid/python/mllib/dom.py b/qpid/python/mllib/dom.py index df2b88322a..486f7082e1 100644 --- a/qpid/python/mllib/dom.py +++ b/qpid/python/mllib/dom.py @@ -148,6 +148,21 @@ class Tag(Node): if name == k: return v + def _idx(self, attr): + idx = 0 + for k, v in self.attrs: + if k == attr: + return idx + idx += 1 + return None + + def set_attr(self, name, value): + idx = self._idx(name) + if idx is None: + self.attrs.append((name, value)) + else: + self.attrs[idx] = (name, value) + def dispatch(self, f): try: attr = "do_" + self.name |
