[Zope-dev] SQL user source, how is this?
Phillip J. Eby
pje@telecommunity.com
Mon, 16 Oct 2000 13:46:01 -0500
At 01:28 PM 10/16/00 -0400, Harry Henry Gebel wrote:
>
>1. Am I doing anything wrong that will bite me later, especially I have not
>implemented all of the cache* methods called in GenericUserFolder because I
>don't understand what these do or what they are for. Are these important
>for my product?
The caching stuff is to avoid repeated database lookups. Keep in mind that
your system will be issuing SQL queries on every web hit. Note that if you
were to use actual Z SQL Method objects instead of raw SQL from Python, you
could set the cache parameters on the Method objects to do most of the
caching work for you.
>2. I would like my client to be able to specify an alternate database
>connection id if he does not want to use the default connection id of
>cc_user_database. If he goes to his CCUserSource's "properties" tab and
>adds a property of use_database_id with the connection id he wants to use,
>how do I access it (this is my first Zope product, so I am learning the
>internals as I go along). Can I use
>
>self.use_database_id
>
Yes, you can do this. The easiest way is to add this to your class:
_properties=(
{'id':'title', 'type': 'string', 'mode': 'w'},
{'id':'use_database_id', 'type': 'string', 'mode': 'w'},
)
use_database_id = "cc_user_database"
This will make the property always exist and it will initially default to
"cc_user_database".