On 27 Oct, 2005, at 1:39 pm, Matthew Bevan wrote:
I discovered a while back the perfect way to do this. Have a
global in
your Inheritance module called _User or whatever, and provide a
function or class method to set this variable. Then I should be able
to do something like:
inheritance.userClass(MyUserClass)
inheritance.groupClass(MyGroupClass)
inheritance.roleClass(MyRoleClass)
Internally, you create new instances (or manage instances of) _User,
_Group, and _Role, or whatever you happen to use.
Actually, that's exactly what got me into all this mess. I read the
class out of the config file and instantiate one when the time comes.
The problem is that SQLObject isn't creating the necessary joins or
something. So when I ask the object derived from identity.model.User
for the Groups to which it belongs, I get an exception.
You simply can not do that with SQLObject classes unless you specify
the top-most one as being an InheritableSQLObject. Even then, this
isn't a very elegant or efficient way of organizing the data, as it
creates two tables (one for the base class, one for MyUser) and
performs two lookups for each .get(). Simple overriding of a
"pointer"
to a class would probably be best. IMHO. YMMV. &c. ;)
I'm not certain I want to require you to use any of the columns in
the identity.model.User class. It should be sufficient to expose the
following properties: userId, groups, and permissions.
The Group objects returned by the groups property need only expose a
groupId property, and the Permission objects returned by the
permissions property only need to expose a permissionId property.
My hope was to allow developers to override only those classes they
*needed* to override. How much information do you usually store in a
group anyway. So most likely, only the User class needed to be
overridden.
I still think this is the ideal way to do this, but for expedience,
I'm going to have to think of alternatives.
--
Jeff Watkins
http://metrocat.org/
Getting an education was a bit like a communicable sexual disease. It
made you unsuitable for a lot of jobs and then you had the urge to
pass it on.
-- (Terry Pratchett, Hogfather)