Re: [SQLObject] SQLObject Class-wide where-condition

2008-02-14 Thread Frank Wagner
Thanks a lot Oleg, that finally was the solution to my problem! You did help me a lot! Kind Regards, Frank On Thu, Feb 14, 2008 at 8:49 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Thu, Feb 14, 2008 at 08:01:45PM +0100, Frank Wagner wrote: > > class Reisen(SQLObject): > > class

Re: [SQLObject] SQLObject Class-wide where-condition

2008-02-14 Thread Oleg Broytmann
On Thu, Feb 14, 2008 at 08:01:45PM +0100, Frank Wagner wrote: > class Reisen(SQLObject): > class sqlmeta: > #some things > pass > > @classmethod > def select(cls, clause=None, **kw): > """docstring for _get_BUCHUNGEN""" > sr

Re: [SQLObject] SQLObject Class-wide where-condition

2008-02-14 Thread Frank Wagner
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

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-29 Thread Frank Wagner
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 <[EM

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-29 Thread Markus Gritsch
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.thread

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-28 Thread Oleg Broytmann
On Mon, Jan 28, 2008 at 11:22:14PM +0100, Frank Wagner wrote: > AttributeError: No connection has been defined for this thread or process You have to open a connection to the DB before you could run a query. You can declare the connection as a string: __connection__ = "sqlite:///path/to/databa

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-28 Thread Frank Wagner
Hi Oleg, thanks again for your help. that works smoothly now, but i´m getting another error now: Whenever i use Reisen.select(/*ANY CLAUSE*/) there comes this error: Traceback (most recent call last): File "", line 1, in ? File "/usr/lib/python2.4/site-packages/SQLObject-0.9.3-py2.4.egg/s

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-28 Thread Oleg Broytmann
On Mon, Jan 28, 2008 at 08:13:05PM +0100, Frank Wagner wrote: > @classmethod > def select(cls, clause=None, **kw): > sresult = SQLObject.select(cls, clause, **kw) > return sresult.filter(~ LIKE(Reisen.q.REISENR, "BUS%")) My mistake. In sresult = SQLObject.select(cls, cla

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-28 Thread Frank Wagner
Hello Oleg, sorry for the late answer, i was away for some time. I really appreciate your help! 1) When i define the function like this: @classmethod def select(cls, **kw): sresult = SQLObject.select(cls, **kw) return sresult.filter(~ LIKE(Reisen.q.REISENR, "BUS%")) and

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-17 Thread Oleg Broytmann
On Thu, Jan 17, 2008 at 08:30:26PM +0100, Frank Wagner wrote: > @classmethod > def select(cls, clause=None, **kw): > > but no matter what i try, it always produces errors. What errors? SyntaxError? @classmethod def select(cls, clause=None, **kw): Indent! Oleg. -- Oleg

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-17 Thread Frank Wagner
i really apologize for asking again, but i cannot make it work. i need it to be a drop-in-replacement, so i dont have to go to each place and adapt the expression. what i have right now is: @classmethod def select(cls, clause=None, **kw): sresult = SQLObject.select(cls, clause, **kw)

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-17 Thread Oleg Broytmann
On Thu, Jan 17, 2008 at 05:44:03PM +0100, Frank Wagner wrote: > really sorry to ask once more. when i now try using this, i get: > TypeError: select() takes exactly 1 argument (2 given) > > you know why? The problem, I think, is in the declaration > >def select(cls, **kw): Now Python

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-17 Thread Frank Wagner
really sorry to ask once more. when i now try using this, i get: TypeError: select() takes exactly 1 argument (2 given) you know why? On Jan 17, 2008 5:33 PM, Oleg Broytmann <[EMAIL PROTECTED]> wrote: > On Thu, Jan 17, 2008 at 05:02:34PM +0100, Frank Wagner wrote: > > yes, this sounds exactly l

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-17 Thread Oleg Broytmann
On Thu, Jan 17, 2008 at 05:02:34PM +0100, Frank Wagner wrote: > yes, this sounds exactly like what i need. > > I inserted it, but it doesn??t work - i??m really sorry but can you help me > out? > > class Reisen(SQLObject): > class sqlmeta: > idName="NR" > REISENR= StringCo

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-17 Thread Frank Wagner
Hi Oleg, yes, this sounds exactly like what i need. I inserted it, but it doesn´t work - i´m really sorry but can you help me out? class Reisen(SQLObject): class sqlmeta: idName="NR" REISENR= StringCol(length=20, alternateID=True, dbName="REISENR") #CHAR(20) def selec

Re: [SQLObject] SQLObject Class-wide where-condition

2008-01-17 Thread Oleg Broytmann
On Thu, Jan 17, 2008 at 04:10:17PM +0100, Frank Wagner wrote: > I would like to put a certain where-condition to a class of mine, so that to > every select against that table my condition is added. I think this must be > put within the class-definition. I think you you'd want to override .selec

[SQLObject] SQLObject Class-wide where-condition

2008-01-17 Thread Frank Wagner
Hello Oleg and folks, I would like to put a certain where-condition to a class of mine, so that to every select against that table my condition is added. I think this must be put within the class-definition. I need it, because there appeared not-planned values in the table i cannot remove, and ins