diff options
| author | Rafael H. Schloming <rhs@apache.org> | 2007-08-22 13:39:04 +0000 |
|---|---|---|
| committer | Rafael H. Schloming <rhs@apache.org> | 2007-08-22 13:39:04 +0000 |
| commit | 51c4f612aec73b473477cacb786865c76284e002 (patch) | |
| tree | 64ab65d87efae9f81ca6e342693cb44f53e458c5 /python/qpid/__init__.py | |
| parent | caa402b97879d849273604842c1ec6bb63e40f26 (diff) | |
| download | qpid-python-51c4f612aec73b473477cacb786865c76284e002.tar.gz | |
added support for 0-10 style header encoding
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@568607 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/qpid/__init__.py')
| -rw-r--r-- | python/qpid/__init__.py | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/python/qpid/__init__.py b/python/qpid/__init__.py index 4aeccae38e..3f6d82b89e 100644 --- a/python/qpid/__init__.py +++ b/python/qpid/__init__.py @@ -31,13 +31,28 @@ class Struct: raise AttributeError(attr) return field - def __setattr__(self, attr, value): + def has(self, name): + return self.type.fields.byname.has_key(name) + + def set(self, attr, value): self._check(attr) self._values[attr] = value - def __getattr__(self, attr): + def get(self, attr): field = self._check(attr) return self._values.get(attr, field.default()) + def __setattr__(self, attr, value): + self.set(attr, value) + + def __getattr__(self, attr): + return self.get(attr) + + def __setitem__(self, attr, value): + self.set(attr, value) + + def __getitem__(self, attr): + return self.get(attr) + def __str__(self): return "%s %s" % (self.type.type, self._values) |
