Nicholas Wieland wrote:
> As usual, my question is rather simple :)
> I'd like to know what are the best practices for product organization -
> for example I have _tons_ of queries to sqlserver, and my main class is
> becoming less manageble every time I look at it :/
> I like the way SQL integrates in Zope, what I don't like is having a
> giant __init__ and a lot of _sqlSomething at the end of the class.
>  
> Can I associate queries to something else than a _variable ? Something
> like a dictionary or a class ? Can I move SQL calls outside the
> initializer ? I'd prefer to have a class for data access and another one
> to glue all the parts together, maybe I'm plain wrong but I think that
> my product would be a lot cleaner.
> What are the best practices for FS based products ? 
> 
> ------------------------------------------------------------------------
> *Yahoo! Mail*
> <http://us.rd.yahoo.com/mail_it/taglines/*http://it.mail.yahoo.com>:
> gratis 1GB per i messaggi, antispam, antivirus, POP3
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )

I can't talk for best practise. You can put your queries also outside of
the init, in this way:

class YourProduct:

        _my_query = SQL('doMyQuery', '',
                'your_connection', '', 'select * from data')

        def __init__(self):
                pass


Also, if you have a *LOT* of queries, consider in building your query on
the fly.

Regards
Marco
begin:vcard
fn:Marco Bizzarri
n:Bizzarri;Marco
org:Icube S.r.l.
adr:;;via Ridolfi 15;Pisa;PI;56124;Italy
email;internet:[EMAIL PROTECTED]
title:Amministratore Delegato
tel;work:+39-050-970-207
tel;fax:+39-050-3136-588
tel;cell:+39-348-640-4861
x-mozilla-html:FALSE
url:http://notenotturne.blogspot.com/
version:2.1
end:vcard

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to