[Zope] "Private" objects?
Lennart Regebro
regebro at nuxeo.com
Wed Feb 4 11:46:21 EST 2004
From: "Kirk Strauser" <kirk at daycos.com>
> OK, then, maybe you could punt me in the right direction. As an example,
I
> have several database connections that are accessed from many non-related
> objects. That is, a particular database may have information on user
> accounts, zip codes, and inventory - not things that are logically related
> to each other. How would you factor these so that those objects all have
> access to the same database, and that database isn't globally accessible
to
> anyone who guesses its name? How could I use products to allow this?
Well, it's hard to say from over here, but I would probably create an object
that maintains the database connection as a subobject that is not directly
accessible. Then I would on that object create methods that do what you want
the methods to do, and set permissions on the objects as you want them.
This would mean that users with the right permissions can access the
methods, but nobody can directly access the database connection.
If you need flexibility in what database connection should be used, then you
could let the object be folderish, and create the database connection inside
it. You could set up that connection to only allow managers to access it.
The python code on the hard disk would still be able to access it.
//Lennart
More information about the Zope
mailing list