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 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:
>
> > AttributeError: No connection has been defined for this thread or process
>
>    I see. The problem is that there is a connection for the class Reisen,
>  but the connection is not passed to SQLObject.select(), because the "cls"
>  parameter is this case is SQLObject, not Reisen, and there is no connection
>  for SQLObject. I see two ways to fix this. Either:
>
>  sresult = SQLObject.select(clause, connection=cls._connection, **kw)
>
>    or
>
>  sresult = super(Reisen, cls).select(clause, **kw)
>
>    In the first case you pass the connection explicitly, in the second case
>  you pass Reisen as the "cls" argument to the the Reisen's parent
>  (SQLObject) .select().
>
>
>  Oleg.
>  --
>      Oleg Broytmann            http://phd.pp.ru/            [EMAIL PROTECTED]
>            Programmers don't die, they just GOSUB without RETURN.
>
>
>
> -------------------------------------------------------------------------
>  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
>

-------------------------------------------------------------------------
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

Reply via email to