[Zope] product organization

Marco Bizzarri m.bizzarri at icube.it
Wed Jul 27 06:14:25 EDT 2005


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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: m.bizzarri.vcf
Type: text/x-vcard
Size: 328 bytes
Desc: not available
Url : http://mail.zope.org/pipermail/zope/attachments/20050727/a404e43f/m.bizzarri.vcf


More information about the Zope mailing list