[Zope-dev] Using db_connections from Zope products

Tom Brown altafare@yahoo.com
Wed, 20 Jun 2001 11:02:15 -0700 (PDT)


> You want to recreate all of the machinery of ZSQL
> methods yourself?

No, I want to be able to intelligently use pieces that
are already there.

> Well, actually it can be done if your database
> supports some
> reasonable API, like the python DB-SIG DB-API 2.0.
> 

I know it can be done, which is why I was asking for
input


> But you are creating a fair amount of work for
> yourself.

I'm fine with the work, but I believe there must be a
way to do it that doesn't require tons.  I could do it
from scratch using pg module, etc.. but figured there
must be something I could use already there

> Just use a ZSQL method and be happy.  (It will
> probably

I don't want to use ZSQL methods, or I want to be able

to define them Dynamically.  I see this sight as a
product with componenets.  Why would I want to
maintain 20 ZSQL methods when I could merely pass a
couple of arguments such as DB name, which would be
instantiated by a manage_addProduct form.  I guess I
could just trick it and pass everything (the whole
select) into the one method as a var, but if I can do
that I should be able to do it directly. 

> make your site more secure if you use ZSQL, as well,
> as
> you will not have to worry as much about argument
> quoting).

As far as argument quoting, why would there be any?
I'm using a class member to take care of querying for
me, why would I be passing arguments to it?  Any
arguments would have been dynamically created based on
the class instantiation.  There are database hooks for
user administration, etc... all I was asking is for a
good example of how to do it...

I was trying to adhere to the principles used in
designing ZClasses, make it look simple...

tons of dtml and "external python methods" mixed in
with 15-20 ZSQL methods just didn't seem to be simple
when it could be made into a product...

__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
http://personal.mail.yahoo.com/