Author: ianb
Date: 2004-07-27 12:38:43 -0400 (Tue, 27 Jul 2004)
New Revision: 165
Modified:
trunk/SQLObject/sqlobject/col.py
trunk/SQLObject/sqlobject/joins.py
Log:
Made name and joinMethodName more exposed on Col and Join objects
Modified: trunk/SQLObject/sqlobject/col.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/SQLObject/sqlobject/col.py 2004-07-27 16:00:29 UTC (rev 164)
+++ trunk/SQLObject/sqlobject/col.py 2004-07-27 16:38:43 UTC (rev 165)
@@ -263,16 +263,21 @@
baseClass =3D SOCol
=20
def __init__(self, name=3DNone, **kw):
- kw['name'] =3D name
+ self._name =3D name
kw['columnDef'] =3D self
self.kw =3D kw
=20
- def setName(self, value):
- assert self.kw['name'] is None, "You cannot change a name after =
it has already been set (from %s to %s)" % (self.kw['name'], value)
- self.kw['name'] =3D value
+ def _set_name(self, value):
+ assert self._name is None, "You cannot change a name after it ha=
s already been set (from %s to %s)" % (self.name, value)
+ self._name =3D value
=20
+ def _get_name(self):
+ return self._name
+
+ name =3D property(_get_name, _set_name)
+
def withClass(self, soClass):
- return self.baseClass(soClass=3DsoClass, **self.kw)
+ return self.baseClass(soClass=3DsoClass, name=3Dself._name, **se=
lf.kw)
=20
class SOStringCol(SOCol):
=20
Modified: trunk/SQLObject/sqlobject/joins.py
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/SQLObject/sqlobject/joins.py 2004-07-27 16:00:29 UTC (rev 164)
+++ trunk/SQLObject/sqlobject/joins.py 2004-07-27 16:38:43 UTC (rev 165)
@@ -17,13 +17,19 @@
kw['otherClass'] =3D otherClass
kw['joinDef'] =3D self
self.kw =3D kw
+ self._joinMethodName =3D None
=20
- def setName(self, value):
- assert self.kw.get('joinMethodName') is None or self.kw['joinMet=
hodName'] =3D=3D value, "You have already given an explicit joinMethodNam=
e (%s), and you are now setting it to %s" % (self.kw['joinMethodName'], v=
alue)
- self.kw['joinMethodName'] =3D value
+ def _set_joinMethodName(self, value):
+ assert self._joinMethodName =3D=3D value or self._joinMethodName=
is None, "You have already given an explicit joinMethodName (%s), and yo=
u are now setting it to %s" % (self._joinMethodName, value)
+ self._joinMethodName =3D value
=20
+ def _get_joinMethodName(self):
+ return self._joinMethodName
+
def withClass(self, soClass):
- return self.baseClass(soClass=3DsoClass, **self.kw)
+ return self.baseClass(soClass=3DsoClass,
+ joinMethodName=3Dself._joinMethodName,
+ **self.kw)
=20
# A join is separate from a foreign key, i.e., it is
# many-to-many, or one-to-many where the *other* class
|