-from turbojson.jsonify import jsonify_sqlobject
-from sercom.model import User, Group, Permission
+#@jsonify.when('isinstance(obj, SQLObject')
+def jsonify_sqlobject(obj):
+ result = {}
+ result['id'] = obj.id
+ cls = obj.sqlmeta.soClass
+ for name in cls.sqlmeta.columns.keys():
+ if name != 'childName':
+ result[name] = getattr(obj, name)
+ while cls.sqlmeta.parentClass:
+ cls = cls.sqlmeta.parentClass
+ for name in cls.sqlmeta.columns.keys():
+ if name != 'childName':
+ result[name] = getattr(obj, name)
+ return result