|
[Webware-discuss] Directory Properties stuff...
From: Daniel Green <daniel.green@nc...> - 2000-08-22 05:25
|
Well, this was relatively painless. Here we have a Zope-style inheriting
property class for WebKit directories. No integration done yet, but it's
being worked on.
For a quick sample, stick DirectoryProperties.py in a directory somewhere.
Create two subdirectories in there:
Root
Root/Admin
put a file called .wk_properties in Root, and put this in it:
{
'AuthHandler' : {
'Type' : 'UserRoleAuthHandler',
'Params' : {
'PasswdFile': '/etc/passwd',
'AcceptRoles' : ['User', 'Guest'],
}
},
'SomeOtherProperty' : 'SomeRandomValue'
}
and this in .wk_properties in Root/Admin:
{
'AuthHandler' : {
'Params' : {
'AcceptRoles' : ['Admin']
}
}
}
which results in a dictionary set up like so:
{
'Root/Admin':
{
'AuthHandler':
{
'Type': 'UserRoleAuthHandler'
'Params':
{
'PasswdFile': '/etc/passwd',
'AcceptRoles': ['Admin']
},
},
'SomeOtherProperty': 'SomeRandomValue'
},
'Root':
{
'AuthHandler':
{
'Type': 'UserRoleAuthHandler',
'Params':
{
'PasswdFile': '/etc/passwd',
'AcceptRoles': ['User', 'Guest']
}
},
'SomeOtherProperty': 'SomeRandomValue'
}
}
(before you get excited, no, I haven't done the authentication stuff. Once
this is finalized, I'll start on that...)
As you can see, Authhandler/Type (and SomeOtherProperty) gets inherited, but
AuthHandler.Params.AcceptRoles gets overridden by the new setting. Should
make configuring stuff pretty easy. It actually does a recursive crawl into
the parent and child dictionaries, copying everything from parent, and then
replacing it with the info from child.
The code is, admittedly, horrendous. I'm going to comment it. Honest.
Dan Green
|
| Thread | Author | Date |
|---|---|---|
| [Webware-discuss] Directory Properties stuff... | Daniel Green <daniel.green@nc...> |