X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/tripe/blobdiff_plain/75566d17f4fd0f18a88360294d6561b25e3681e5..c7737d905aad7a2aaf523b1444f2b69a0088402a:/svc/connect.in diff --git a/svc/connect.in b/svc/connect.in index 607a6561..7a935723 100644 --- a/svc/connect.in +++ b/svc/connect.in @@ -296,12 +296,15 @@ class Peer (object): a FILTER function is given then apply it to the information from the database before returning it. """ - attr = me.__dict__.get(key, default) - if attr is _magic: - raise T.TripeJobError('malformed-peer', me.name, 'missing-key', key) - elif filter is not None: - attr = filter(attr) - return attr + try: + attr = me.__dict__[key] + except KeyError: + if default is _magic: + raise T.TripeJobError('malformed-peer', me.name, 'missing-key', key) + return default + else: + if filter is not None: attr = filter(attr) + return attr def has(me, key): """