In SQLObject, a class is a table, an instance is a row of that table. You
appear to be confusing object initialization with class initialization -
things in sqlmeta apply to how the class is defined, basically happens at
import time. __init__ is not called until you try to create an instance of =
the
class.
I'm not entirely sure what your end goal is here, maybe you could
describe what
you're trying to accomplish as opposed to how you're trying to accomplish i=
t?
- Luke
Quoting Felix <felixonta@...>:
> On Thu, 23 Mar 2006 19:46:08 +0100
> j=FCrgen Kartnaller <juergen@...> wrote:
>
>> class tablaBD(sqlobject.SQLObject):
>> class sqlmeta:
>> table =3D self.tabla
>> fromDatabase =3D True
>> def __init__(self, conexion, tabla):
>> SQLObject.__init__(self)
>> self._connection =3D conexion
>> self.sqlmeta.table =3D tabla
>>
>> At least Python accepts this, dunno if SQLObject accepts it.
>
> Thanks but no success: sqlmeta dont know about self.tabla
> but i tried:
>
> class tablaBD(sqlobject.SQLObject):
> def __init__(self, conexion, tabla):
> sqlobject.SQLObject.__init__(self)
> self._connection =3D conexion
> self.sqlmeta.table =3D tabla
>
> And it's no python problem but sqlobject:
>
> Traceback (most recent call last):
> File "conexionBD2.py", line 31, in ?
> tabla =3D tablaBD(manejador.connection, manejador.tabla)
> File "conexionBD2.py", line 24, in __init__
> sqlobject.SQLObject.__init__(self)
> File
> "/usr/lib/python2.3/site-packages/SQLObject-0.7.0-py2.3.egg/sqlobject/mai=
n.py", line 1183, in
> __init__
> self._create(id, **kw)
> File
> "/usr/lib/python2.3/site-packages/SQLObject-0.7.0-py2.3.egg/sqlobject/mai=
n.py", line 1210, in
> _create
> self._SO_finishCreate(id)
> File
> "/usr/lib/python2.3/site-packages/SQLObject-0.7.0-py2.3.egg/sqlobject/mai=
n.py", line 1233, in
> _SO_finishCreate
> id =3D self._connection.queryInsertID(self,
> File
> "/usr/lib/python2.3/site-packages/SQLObject-0.7.0-py2.3.egg/sqlobject/dbc=
onnection.py", line 848, in
> __get__
> return self.getConnection()
> File
> "/usr/lib/python2.3/site-packages/SQLObject-0.7.0-py2.3.egg/sqlobject/dbc=
onnection.py", line 860, in
> getConnection
> raise AttributeError(
> AttributeError: No connection has been defined for this thread or process
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by xPML, a groundbreaking scripting langua=
ge
> that extends applications into web and mobile media. Attend the live webc=
ast
> and join the prime developer group breaking into this new coding territor=
y!
> http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=110944&bid$1720&dat=121642
> _______________________________________________
> sqlobject-discuss mailing list
> sqlobject-discuss@...
> https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
>
--
The Pursuit of Counterfactual Histories
|