From c0d634fe8ceb3bf35a4fc1b11db0f11e24f44128 Mon Sep 17 00:00:00 2001 From: Griatch Date: Sun, 3 Feb 2013 00:23:58 +0100 Subject: [PATCH] Added "typeclass" as a shortcut variable name of __getattribute__. This allows for obj.typeclass to always cleanly return typeclass regardless of if obj is already a typeclass or is a database object. I.e. the same functionality of using obj.dbobj to always get the database object. --- src/typeclasses/typeclass.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/typeclasses/typeclass.py b/src/typeclasses/typeclass.py index f708ede3a1..87c5c93075 100644 --- a/src/typeclasses/typeclass.py +++ b/src/typeclasses/typeclass.py @@ -97,6 +97,8 @@ class TypeClass(object): """ if propname == 'dbobj': return _GA(self, 'dbobj') + if propname == 'typeclass': + return self if propname.startswith('__') and propname.endswith('__'): # python specials are parsed as-is (otherwise things like # isinstance() fail to identify the typeclass)