Hi Oleg, Hello folks, unfortunately i am still struggeling with this problem.
I´ll summarize the latest version of my problem as some time has gone by since you read about this. I want to override the select method for certain SQL-Obecjt classes to establish customized, project-wide filters for some rows in the according table. if i do so and put the function as follows in my class i get an error (see below): hub = PackageHub("there.where.the.dsn.is") __connection__ = hub class Reisen(SQLObject): class sqlmeta: #some things pass @classmethod def select(cls, clause=None, **kw): """docstring for _get_BUCHUNGEN""" sresult = SQLObject.select(clause, **kw) return sresult.filter(~ LIKE(Reisen.q.REISENR, "BUS%")) .... Reisen.select(...) leads to an error: Traceback (most recent call last): File "<console>", line 1, in ? File "/usr/lib/python2.4/site-packages/SQLObject-0.9.3-py2.4.egg/sqlobject/sresults.py", line 162, in __iter__ return iter(list(self.lazyIter())) File "/usr/lib/python2.4/site-packages/SQLObject-0.9.3-py2.4.egg/sqlobject/sresults.py", line 169, in lazyIter conn = self._getConnection() File "/usr/lib/python2.4/site-packages/SQLObject-0.9.3-py2.4.egg/sqlobject/sresults.py", line 45, in _getConnection return self.ops.get('connection') or self.sourceClass._connection File "/usr/lib/python2.4/site-packages/SQLObject-0.9.3-py2.4.egg/sqlobject/dbconnection.py", line 973, in __get__ return self.getConnection() File "/usr/lib/python2.4/site-packages/SQLObject-0.9.3-py2.4.egg/sqlobject/dbconnection.py", line 985, in getConnection raise AttributeError( AttributeError: No connection has been defined for this thread or process If i remove the overridden select-method everything works smoothly (of course without the filters i want to establish that way). Can you please help me? KR, Frank On Tue, Jan 29, 2008 at 8:31 PM, Frank Wagner <[EMAIL PROTECTED]> wrote: > Thanks Oleg and Markus, > > actually all this is about a Turbogears-proejct. > The connection has been defined and it works fine for all other classes. > It just doesn´t work anymore for the class, where i´ve overwritten the > select() method... > > Regards, > Frank > > > On Jan 29, 2008 11:11 AM, Markus Gritsch <[EMAIL PROTECTED]> wrote: > > > > > > On 28/01/2008, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > > > > > > connection = sqlobject.connectionForURI("sqlite:///path/to/database.db") > > > > > > and set it globally: > > > > > > sqlobject.sqlhub = connection > > > > I think this should read > > > > sqlobject.sqlhub.processConnection = connection > > > > or > > > > sqlobject.sqlhub.threadConnection = connection > > > > instead. > > > > Markus > > > > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss