On Tue, Mar 22, 2011 at 10:26:22AM +0100, Gregor Horvath wrote:
> But I would prefer to make an optional argument 'columns' to
> queryForSelect, because it is not obvious that the columns / items can
> be changed after initialisation.
> 
> so it would be 
> 
> list_ = list_.queryForSelect(columns=[list_.sourceClass.q.id])

   Hmm... I don't like this approach, at least at the first glance. I
have to think about it, but now I'd rather split queryForSelect into two
functions. Something like this:

    def queryForSelect(self):
        columns = [self.sourceClass.q.id] + [getattr(self.sourceClass.q, 
x.name) for x in self.sourceClass.sqlmeta.columnList]
        return self.makeQuery(columns)

    def makeQuery(self, columns):
        query = sqlbuilder.Select(columns,
            ...

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            p...@phdru.name
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to