sqlobject-cvs Mailing List for SQLObject (Page 162)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(74) |
May
(29) |
Jun
(16) |
Jul
(28) |
Aug
(10) |
Sep
(57) |
Oct
(9) |
Nov
(29) |
Dec
(12) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(7) |
Feb
(14) |
Mar
(6) |
Apr
(3) |
May
(12) |
Jun
(34) |
Jul
(9) |
Aug
(29) |
Sep
(22) |
Oct
(2) |
Nov
(15) |
Dec
(52) |
2005 |
Jan
(47) |
Feb
(78) |
Mar
(14) |
Apr
(35) |
May
(33) |
Jun
(16) |
Jul
(26) |
Aug
(63) |
Sep
(40) |
Oct
(96) |
Nov
(96) |
Dec
(123) |
2006 |
Jan
(159) |
Feb
(144) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(48) |
Jul
(16) |
Aug
(64) |
Sep
(87) |
Oct
(92) |
Nov
(56) |
Dec
(76) |
2007 |
Jan
(94) |
Feb
(103) |
Mar
(126) |
Apr
(123) |
May
(85) |
Jun
(11) |
Jul
(130) |
Aug
(47) |
Sep
(65) |
Oct
(70) |
Nov
(12) |
Dec
(11) |
2008 |
Jan
(30) |
Feb
(55) |
Mar
(88) |
Apr
(20) |
May
(50) |
Jun
|
Jul
(38) |
Aug
(1) |
Sep
(9) |
Oct
(5) |
Nov
(6) |
Dec
(39) |
2009 |
Jan
(8) |
Feb
(16) |
Mar
(3) |
Apr
(33) |
May
(44) |
Jun
(1) |
Jul
(10) |
Aug
(33) |
Sep
(74) |
Oct
(22) |
Nov
|
Dec
(15) |
2010 |
Jan
(28) |
Feb
(22) |
Mar
(46) |
Apr
(29) |
May
(1) |
Jun
(1) |
Jul
(27) |
Aug
(8) |
Sep
(5) |
Oct
(33) |
Nov
(24) |
Dec
(41) |
2011 |
Jan
(4) |
Feb
(12) |
Mar
(35) |
Apr
(29) |
May
(19) |
Jun
(16) |
Jul
(32) |
Aug
(25) |
Sep
(5) |
Oct
(11) |
Nov
(21) |
Dec
(12) |
2012 |
Jan
(3) |
Feb
(4) |
Mar
(20) |
Apr
(4) |
May
(25) |
Jun
(13) |
Jul
|
Aug
|
Sep
(2) |
Oct
(25) |
Nov
(9) |
Dec
(1) |
2013 |
Jan
(6) |
Feb
(8) |
Mar
|
Apr
(10) |
May
(31) |
Jun
(7) |
Jul
(18) |
Aug
(33) |
Sep
(4) |
Oct
(16) |
Nov
|
Dec
(27) |
2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(11) |
May
(39) |
Jun
(8) |
Jul
(11) |
Aug
(4) |
Sep
|
Oct
(27) |
Nov
|
Dec
(71) |
2015 |
Jan
(17) |
Feb
(47) |
Mar
(33) |
Apr
|
May
|
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
2016 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
|
May
(12) |
Jun
(7) |
Jul
(9) |
Aug
(31) |
Sep
(8) |
Oct
(3) |
Nov
(15) |
Dec
(1) |
2017 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(8) |
May
(10) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(4) |
Dec
(5) |
2018 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
(4) |
May
|
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
2019 |
Jan
(1) |
Feb
(16) |
Mar
(1) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(3) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(4) |
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(9) |
2025 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sub...@co...> - 2005-08-19 17:54:25
|
Author: test Date: 2005-08-19 17:54:17 +0000 (Fri, 19 Aug 2005) New Revision: 927 Modified: trunk/SQLObject/scripts/sqlobject-admin Log: Allow dev version Modified: trunk/SQLObject/scripts/sqlobject-admin =================================================================== --- trunk/SQLObject/scripts/sqlobject-admin 2005-08-19 17:53:59 UTC (rev 926) +++ trunk/SQLObject/scripts/sqlobject-admin 2005-08-19 17:54:17 UTC (rev 927) @@ -4,7 +4,7 @@ try: import pkg_resources - pkg_resources.require('SQLObject>=0.7') + pkg_resources.require('SQLObject>=0.7dev') except (ImportError, pkg_resources.DistributionNotFound): # Oh well, we tried... pass |
From: <sub...@co...> - 2005-08-19 17:54:12
|
Author: test Date: 2005-08-19 17:53:59 +0000 (Fri, 19 Aug 2005) New Revision: 926 Modified: trunk/SQLObject/sqlobject/manager/command.py Log: Ignore (warn) on tables that can't be read into SQLObject classes Modified: trunk/SQLObject/sqlobject/manager/command.py =================================================================== --- trunk/SQLObject/sqlobject/manager/command.py 2005-08-19 04:35:11 UTC (rev 925) +++ trunk/SQLObject/sqlobject/manager/command.py 2005-08-19 17:53:59 UTC (rev 926) @@ -497,6 +497,10 @@ columnsFromSchema_warning = True good += 1 continue + except AssertionError, e: + print 'Cannot read db table %s: %s' % ( + soClass.sqlmeta.table, e) + continue existing = {} for col in columns: col = col.withClass(soClass) |
From: <sub...@co...> - 2005-08-19 04:35:16
|
Author: ianb Date: 2005-08-19 04:35:11 +0000 (Fri, 19 Aug 2005) New Revision: 925 Modified: trunk/SQLObject/docs/SQLObject.txt Log: Fix a couple links Modified: trunk/SQLObject/docs/SQLObject.txt =================================================================== --- trunk/SQLObject/docs/SQLObject.txt 2005-08-19 04:34:57 UTC (rev 924) +++ trunk/SQLObject/docs/SQLObject.txt 2005-08-19 04:35:11 UTC (rev 925) @@ -8,10 +8,9 @@ ========================= SQLObject is by Ian Bicking (ia...@co...) and `Contributors -<Authors.html>`_. The website is sqlobject.org__. +<Authors.html>`_. The website is `sqlobject.org +<http://sqlobject.org>`_. -__ http://sqlobject.org - The code is licensed under the `Lesser General Public License`_ (LGPL). @@ -177,8 +176,8 @@ treat that key as immutable (otherwise you'll confuse SQLObject terribly). -You can `override the id name`__ in the database, but it is always -called ``.id`` from Python. +You can `override the id name <#idName>`_ in the database, but it is +always called ``.id`` from Python. Using the Class --------------- |
From: <sub...@co...> - 2005-08-19 04:35:04
|
Author: ianb Date: 2005-08-19 04:34:57 +0000 (Fri, 19 Aug 2005) New Revision: 924 Modified: trunk/SQLObject/setup.py Log: FormEncode etc. update Modified: trunk/SQLObject/setup.py =================================================================== --- trunk/SQLObject/setup.py 2005-08-19 03:18:47 UTC (rev 923) +++ trunk/SQLObject/setup.py 2005-08-19 04:34:57 UTC (rev 924) @@ -13,7 +13,7 @@ DistributionMetadata.download_url = None setup(name="SQLObject", - version="0.7b1", + version="0.7", description="Object-Relational Manager, aka database wrapper", long_description="""\ Classes created using SQLObject wrap database rows, presenting a @@ -38,7 +38,14 @@ license="LGPL", packages=["sqlobject"] + ['sqlobject.%s' % package for package in subpackages], scripts=["scripts/sqlobject-admin"], - download_url="http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.7b1.tar.gz?download") + install_requires=["FormEncode>=0.2"], + extras_require={ + 'postgresql': ['psycopg'], + 'mysql': ['MySQLdb'], + 'sqlite': ['pysqlite'], + # Others? + }, + ) # Send announce to: # sql...@li... |
From: <sub...@co...> - 2005-08-19 03:14:01
|
Author: ianb Date: 2005-08-19 03:13:46 +0000 (Fri, 19 Aug 2005) New Revision: 921 Removed: trunk/SQLObject/sqlobject/include/ Modified: trunk/SQLObject/docs/DeveloperGuide.txt trunk/SQLObject/sqlobject/__init__.py trunk/SQLObject/sqlobject/col.py trunk/SQLObject/sqlobject/main.py trunk/SQLObject/sqlobject/postgres/pgconnection.py trunk/SQLObject/sqlobject/tests/test_enum.py trunk/SQLObject/sqlobject/tests/test_validation.py Log: Moved to FormEncode for the validators; see DeveloperGuide for new installation process Modified: trunk/SQLObject/docs/DeveloperGuide.txt =================================================================== --- trunk/SQLObject/docs/DeveloperGuide.txt 2005-08-19 03:09:06 UTC (rev 920) +++ trunk/SQLObject/docs/DeveloperGuide.txt 2005-08-19 03:13:46 UTC (rev 921) @@ -14,6 +14,25 @@ -- Ian Bicking +Development Installation +======================== + +First install `FormEncode <http://formencode.org>`_:: + + $ svn co http://svn.colorstudy.com/FormEncode/trunk FormEncode + $ cd FormEncode + $ sudo python setup.py develop + +Then do the same for SQLObject:: + + $ svn co http://svn.colorstudy.com/trunk/SQLObject SQLObject + $ cd SQLObject + $ sudo python setup.py develop + +Voila! The packages are globally installed, but the files from the +checkout were not copied into ``site-packages``. See `setuptools +<http://peak.telecommunity.com/DevCenter/setuptools>`_ for more. + Style Guide =========== Modified: trunk/SQLObject/sqlobject/__init__.py =================================================================== --- trunk/SQLObject/sqlobject/__init__.py 2005-08-19 03:09:06 UTC (rev 920) +++ trunk/SQLObject/sqlobject/__init__.py 2005-08-19 03:13:46 UTC (rev 921) @@ -4,7 +4,6 @@ from styles import * from joins import * from index import * -from include import validators from dbconnection import connectionForURI ## Each of these imports allows the driver to install itself Modified: trunk/SQLObject/sqlobject/col.py =================================================================== --- trunk/SQLObject/sqlobject/col.py 2005-08-19 03:09:06 UTC (rev 920) +++ trunk/SQLObject/sqlobject/col.py 2005-08-19 03:13:46 UTC (rev 921) @@ -27,7 +27,8 @@ # Sadly the name "constraints" conflicts with many of the function # arguments in this module, so we rename it: import constraints as consts -from include import validators +from formencode import compound +from formencode import validators from classregistry import findClass from converters import array_type from util.backports import count @@ -78,12 +79,12 @@ creationOrder = count() -class SQLValidator(validators.All): +class SQLValidator(compound.All): def attemptConvert(self, value, state, validate): - if validate is validators.toPython: + if validate is validators.to_python: vlist = list(self.validators[:]) vlist.reverse() - elif validate is validators.fromPython: + elif validate is validators.from_python: vlist = self.validators else: raise RuntimeError @@ -121,6 +122,8 @@ lazy=False, noCache=False, forceDBName=False, + title=None, + tags=[], origName=None, extra_vars=None): @@ -213,6 +216,8 @@ # this is in case of ForeignKey, where we rename the column # and append an ID self.origName = origName or name + self.title = title + self.tags = tags if extra_vars: for name, value in extra_vars.items(): @@ -221,11 +226,11 @@ def _set_validator(self, value): self._validator = value if self._validator: - self.toPython = self._validator.toPython - self.fromPython = self._validator.fromPython + self.to_python = self._validator.to_python + self.from_python = self._validator.from_python else: - self.toPython = None - self.fromPython = None + self.to_python = None + self.from_python = None def _get_validator(self): return self._validator @@ -477,14 +482,14 @@ class StringValidator(validators.Validator): - def toPython(self, value, state): + def to_python(self, value, state): if value is None: return None if isinstance(value, unicode): return value.encode("ascii") return value - def fromPython(self, value, state): + def from_python(self, value, state): if value is None: return None if isinstance(value, str): @@ -504,14 +509,14 @@ class UnicodeStringValidator(validators.Validator): - def toPython(self, value, state): + def to_python(self, value, state): if value is None: return None if isinstance(value, unicode): return value return unicode(value, self.db_encoding) - def fromPython(self, value, state): + def from_python(self, value, state): if value is None: return None if isinstance(value, str): @@ -533,7 +538,7 @@ class IntValidator(validators.Validator): - def toPython(self, value, state): + def to_python(self, value, state): if value is None: return None if isinstance(value, (int, long, sqlbuilder.SQLExpression)): @@ -544,14 +549,14 @@ except OverflowError: # for Python 2.2 return long(value) except: - raise validators.InvalidField("expected an int in the IntCol '%s', got %s instead" % \ + raise validators.Invalid("expected an int in the IntCol '%s', got %s instead" % \ (self.name, type(value)), value, state) - def fromPython(self, value, state): + def from_python(self, value, state): if value is None: return None if not isinstance(value, (int, long, sqlbuilder.SQLExpression)): - raise validators.InvalidField("expected an int in the IntCol '%s', got %s instead" % \ + raise validators.Invalid("expected an int in the IntCol '%s', got %s instead" % \ (self.name, type(value)), value, state) return value @@ -573,7 +578,7 @@ class BoolValidator(validators.Validator): - def toPython(self, value, state): + def to_python(self, value, state): if value is None: return None elif not value: @@ -581,7 +586,7 @@ else: return sqlbuilder.TRUE - def fromPython(self, value, state): + def from_python(self, value, state): if value is None: return None elif value: @@ -621,7 +626,7 @@ class FloatValidator(validators.Validator): - def toPython(self, value, state): + def to_python(self, value, state): if value is None: return None if isinstance(value, (int, long, float, sqlbuilder.SQLExpression)): @@ -629,14 +634,14 @@ try: return float(value) except: - raise validators.InvalidField("expected a float in the FloatCol '%s', got %s instead" % \ + raise validators.Invalid("expected a float in the FloatCol '%s', got %s instead" % \ (self.name, type(value)), value, state) - def fromPython(self, value, state): + def from_python(self, value, state): if value is None: return None if not isinstance(value, (int, long, float, sqlbuilder.SQLExpression)): - raise validators.InvalidField("expected a float in the FloatCol '%s', got %s instead" % \ + raise validators.Invalid("expected a float in the FloatCol '%s', got %s instead" % \ (self.name, type(value)), value, state) return value @@ -765,6 +770,10 @@ def autoConstraints(self): return [consts.isString, consts.InList(self.enumValues)] + def createValidators(self): + return [EnumValidator(name = self.name, enumValues = self.enumValues)] + \ + super(SOEnumCol, self).createValidators() + def _mysqlType(self): return "ENUM(%s)" % ', '.join([sqlbuilder.sqlrepr(v, 'mysql') for v in self.enumValues]) @@ -790,13 +799,25 @@ def _maxdbType(self): raise "Enum type is not supported" +class EnumValidator(validators.Validator): + + def to_python(self, value, state): + if value in self.enumValues: + return value + else: + raise validators.Invalid("expected a member of %r in the EnumCol '%s', got %r instead" % \ + (self.enumValues, self.name, value), value, state) + + def from_python(self, value, state): + return self.to_python(value, state) + class EnumCol(Col): baseClass = SOEnumCol if datetime_available: class DateTimeValidator(validators.DateValidator): - def toPython(self, value, state): + def to_python(self, value, state): if value is None: return None if isinstance(value, (datetime.date, datetime.datetime, sqlbuilder.SQLExpression)): @@ -811,24 +832,24 @@ try: stime = time.strptime(value, self.format) except: - raise validators.InvalidField("expected an date/time string of the '%s' format in the DateTimeCol '%s', got %s instead" % \ + raise validators.Invalid("expected an date/time string of the '%s' format in the DateTimeCol '%s', got %s instead" % \ (self.format, self.name, type(value)), value, state) secs = time.mktime(stime) return datetime.datetime.fromtimestamp(secs) - def fromPython(self, value, state): + def from_python(self, value, state): if value is None: return None if isinstance(value, (datetime.date, datetime.datetime, sqlbuilder.SQLExpression)): return value if hasattr(value, "strftime"): return value.strftime(self.format) - raise validators.InvalidField("expected a datetime in the DateTimeCol '%s', got %s instead" % \ + raise validators.Invalid("expected a datetime in the DateTimeCol '%s', got %s instead" % \ (self.name, type(value)), value, state) if mxdatetime_available: class MXDateTimeValidator(validators.DateValidator): - def toPython(self, value, state): + def to_python(self, value, state): if value is None: return None if isinstance(value, (DateTimeType, sqlbuilder.SQLExpression)): @@ -842,18 +863,18 @@ try: stime = time.strptime(value, self.format) except: - raise validators.InvalidField("expected an date/time string of the '%s' format in the DateTimeCol '%s', got %s instead" % \ + raise validators.Invalid("expected an date/time string of the '%s' format in the DateTimeCol '%s', got %s instead" % \ (self.format, self.name, type(value)), value, state) return DateTime.mktime(stime) - def fromPython(self, value, state): + def from_python(self, value, state): if value is None: return None if isinstance(value, (DateTimeType, sqlbuilder.SQLExpression)): return value if hasattr(value, "strftime"): return value.strftime(self.format) - raise validators.InvalidField("expected a mxDateTime in the DateTimeCol '%s', got %s instead" % \ + raise validators.Invalid("expected a mxDateTime in the DateTimeCol '%s', got %s instead" % \ (self.name, type(value)), value, state) class SODateTimeCol(SOCol): @@ -909,13 +930,13 @@ if datetime_available: class DateValidator(DateTimeValidator): - def toPython(self, value, state): - value = super(DateValidator, self).toPython(value, state) + def to_python(self, value, state): + value = super(DateValidator, self).to_python(value, state) if isinstance(value, datetime.datetime): value = datetime.date(value.year, value.month, value.day) return value - fromPython = toPython + from_python = to_python class SODateCol(SOCol): dateFormat = '%Y-%m-%d' @@ -994,7 +1015,9 @@ of wrapper type for binary conversion. """ - def toPython(self, value, state): + _cachedValue = None + + def to_python(self, value, state): if value is None: return None if isinstance(value, str): @@ -1003,20 +1026,21 @@ value = module.decode(value) return value if isinstance(value, state.soObject._connection._binaryType): - if hasattr(self, "_binaryValue") and (value == self._binaryValue): - return self._origValue + cachedValue = self._cachedValue + if cachedValue and cachedValue[1] == value: + return cachedValue[0] if isinstance(value, array_type): # MySQL return value.tostring() return str(value) # buffer => string - raise validators.InvalidField("expected a string in the BLOBCol '%s', got %s instead" % \ + raise validators.Invalid("expected a string in the BLOBCol '%s', got %s instead" % \ (self.name, type(value)), value, state) - def fromPython(self, value, state): + def from_python(self, value, state): if value is None: return None - self._origValue = value # store the original value - self._binaryValue = state.soObject._connection.createBinary(value) - return self._binaryValue + binary = state.soObject._connection.createBinary(value) + self._cachedValue = (value, binary) + return binary class SOBLOBCol(SOStringCol): def createValidators(self): @@ -1043,42 +1067,46 @@ class PickleValidator(BinaryValidator): """ - Validator for pickle types. A pickle type is simply a binary type with - hidden pickling, so that we can simply store any kind of stuff in a - particular column. + Validator for pickle types. A pickle type is simply a binary type + with hidden pickling, so that we can simply store any kind of + stuff in a particular column. - The support for this relies directly on the support for binary for your - database. + The support for this relies directly on the support for binary for + your database. """ - def toPython(self, value, state): + def to_python(self, value, state): + print str(value) if value is None: return None if isinstance(value, unicode): value = value.encode("ascii") if isinstance(value, str): + print repr(value) return pickle.loads(value) - raise validators.InvalidField("expected a pickle string in the PickleCol '%s', got %s instead" % \ + raise validators.Invalid("expected a pickle string in the PickleCol '%s', got %s instead" % \ (self.name, type(value)), value, state) - def fromPython(self, value, state): + def from_python(self, value, state): + print "IN/OUT", [value, pickle.dumps(value)] if value is None: return None return pickle.dumps(value) class SOPickleCol(SOBLOBCol): + def __init__(self, **kw): self.pickleProtocol = popKey(kw, 'pickleProtocol', 1) SOBLOBCol.__init__(self, **kw) def createValidators(self): - return [PickleValidator(name=self.name, pickleProtocol=self.pickleProtocol)] + \ + return [PickleValidator( + name=self.name, pickleProtocol=self.pickleProtocol)] + \ super(SOPickleCol, self).createValidators() class PickleCol(BLOBCol): baseClass = SOPickleCol - def popKey(kw, name, default=None): if not kw.has_key(name): return default Modified: trunk/SQLObject/sqlobject/main.py =================================================================== --- trunk/SQLObject/sqlobject/main.py 2005-08-19 03:09:06 UTC (rev 920) +++ trunk/SQLObject/sqlobject/main.py 2005-08-19 03:13:46 UTC (rev 921) @@ -40,6 +40,7 @@ import classregistry import declarative from sresults import SelectResults +from formencode import schema, compound import sys if sys.version_info[:3] < (2, 2, 0): @@ -338,9 +339,9 @@ # making the table read-only if not column.immutable: # We start by just using the _SO_setValue method - setter = eval('lambda self, val: self._SO_setValue(%s, val, self.%s, self.%s)' % (repr(name), '_SO_fromPython_%s' % name, '_SO_toPython_%s' % name)) - setattr(soClass, '_SO_fromPython_%s' % name, column.fromPython) - setattr(soClass, '_SO_toPython_%s' % name, column.toPython) + setter = eval('lambda self, val: self._SO_setValue(%s, val, self.%s, self.%s)' % (repr(name), '_SO_from_python_%s' % name, '_SO_to_python_%s' % name)) + setattr(soClass, '_SO_from_python_%s' % name, column.from_python) + setattr(soClass, '_SO_to_python_%s' % name, column.to_python) setattr(soClass, rawSetterName(name), setter) # Then do the aliasing if not hasattr(soClass, setterName(name)) or (name == 'childName'): @@ -556,7 +557,7 @@ index = indexDef.withClass(cls.soClass) cls.indexes.append(index) addIndex = classmethod(addIndex) - + sqlhub = dbconnection.ConnectionHub() class _sqlmeta_attr(object): @@ -809,6 +810,7 @@ delJoin = _sqlmeta_attr('delJoin', 2) addIndex = _sqlmeta_attr('addIndex', 2) delIndex = _sqlmeta_attr('delIndex', 2) + getSchema = _sqlmeta_attr('getSchema', 2) # @classmethod def _SO_setupSqlmeta(cls, new_attrs, is_base): @@ -1012,7 +1014,7 @@ finally: self._SO_writeLock.release() - def _SO_setValue(self, name, value, fromPython, toPython): + def _SO_setValue(self, name, value, from_python, to_python): # This is the place where we actually update the # database. @@ -1020,12 +1022,12 @@ # in the database, and we can't insert it until all # the parts are set. So we just keep them in a # dictionary until later: - if fromPython: - dbValue = fromPython(value, self._SO_validatorState) + if from_python: + dbValue = from_python(value, self._SO_validatorState) else: dbValue = value - if toPython: - value = toPython(dbValue, self._SO_validatorState) + if to_python: + value = to_python(dbValue, self._SO_validatorState) if self.sqlmeta._creating or self.sqlmeta.lazyUpdate: self.dirty = True self._SO_createValues[name] = dbValue @@ -1056,14 +1058,14 @@ # _creating is special, see _SO_setValue if self.sqlmeta._creating or self.sqlmeta.lazyUpdate: for name, value in kw.items(): - fromPython = getattr(self, '_SO_fromPython_%s' % name, None) - if fromPython: - kw[name] = dbValue = fromPython(value, self._SO_validatorState) + from_python = getattr(self, '_SO_from_python_%s' % name, None) + if from_python: + kw[name] = dbValue = from_python(value, self._SO_validatorState) else: dbValue = value - toPython = getattr(self, '_SO_toPython_%s' % name, None) - if toPython: - value = toPython(dbValue, self._SO_validatorState) + to_python = getattr(self, '_SO_to_python_%s' % name, None) + if to_python: + value = to_python(dbValue, self._SO_validatorState) setattr(self, instanceName(name), value) for name, value in extra.items(): try: @@ -1093,14 +1095,14 @@ # else into a single UPDATE, if necessary. toUpdate = {} for name, value in kw.items(): - fromPython = getattr(self, '_SO_fromPython_%s' % name, None) - if fromPython: - dbValue = fromPython(value, self._SO_validatorState) + from_python = getattr(self, '_SO_from_python_%s' % name, None) + if from_python: + dbValue = from_python(value, self._SO_validatorState) else: dbValue = value - toPython = getattr(self, '_SO_toPython_%s' % name, None) - if toPython: - value = toPython(dbValue, self._SO_validatorState) + to_python = getattr(self, '_SO_to_python_%s' % name, None) + if to_python: + value = to_python(dbValue, self._SO_validatorState) if self.sqlmeta.cacheValues: setattr(self, instanceName(name), value) toUpdate[name] = dbValue @@ -1124,8 +1126,8 @@ def _SO_selectInit(self, row): for col, colValue in zip(self.sqlmeta.columnList, row): - if col.toPython: - colValue = col.toPython(colValue, self._SO_validatorState) + if col.to_python: + colValue = col.to_python(colValue, self._SO_validatorState) setattr(self, instanceName(col.name), colValue) def _SO_getValue(self, name): @@ -1141,8 +1143,8 @@ assert results != None, "%s with id %s is not in the database" \ % (self.__class__.__name__, self.id) value = results[0] - if column.toPython: - value = column.toPython(value, self._SO_validatorState) + if column.to_python: + value = column.to_python(value, self._SO_validatorState) return value def _SO_foreignKey(self, id, joinClass): Modified: trunk/SQLObject/sqlobject/postgres/pgconnection.py =================================================================== --- trunk/SQLObject/sqlobject/postgres/pgconnection.py 2005-08-19 03:09:06 UTC (rev 920) +++ trunk/SQLObject/sqlobject/postgres/pgconnection.py 2005-08-19 03:13:46 UTC (rev 921) @@ -102,6 +102,7 @@ q = self._insertSQL(table, names, values) if self.debug: self.printDebug(conn, q, 'QueryIns') + print [q] c.execute(q) if self.debugOutput: self.printDebug(conn, id, 'QueryIns', 'result') Modified: trunk/SQLObject/sqlobject/tests/test_enum.py =================================================================== --- trunk/SQLObject/sqlobject/tests/test_enum.py 2005-08-19 03:09:06 UTC (rev 920) +++ trunk/SQLObject/sqlobject/tests/test_enum.py 2005-08-19 03:13:46 UTC (rev 921) @@ -1,5 +1,6 @@ from sqlobject import * from sqlobject.tests.dbtest import * +from formencode import Invalid ######################################## ## Enum test @@ -13,8 +14,8 @@ setupClass(Enum1) for l in ['a', 'bcd', 'a', 'e']: Enum1(l=l) - if supports('restrictedEnum'): - raises( - (Enum1._connection.module.IntegrityError, - Enum1._connection.module.ProgrammingError), - Enum1, l='b') + raises( + (Enum1._connection.module.IntegrityError, + Enum1._connection.module.ProgrammingError, + Invalid), + Enum1, l='b') Modified: trunk/SQLObject/sqlobject/tests/test_validation.py =================================================================== --- trunk/SQLObject/sqlobject/tests/test_validation.py 2005-08-19 03:09:06 UTC (rev 920) +++ trunk/SQLObject/sqlobject/tests/test_validation.py 2005-08-19 03:13:46 UTC (rev 921) @@ -1,5 +1,6 @@ from sqlobject import * from sqlobject.tests.dbtest import * +from formencode import validators ######################################## ## Validation/conversion @@ -8,7 +9,7 @@ class SOValidation(SQLObject): name = StringCol(validator=validators.PlainText(), default='x', dbName='name_col') - name2 = StringCol(validator=validators.ConfirmType(str), default='y') + name2 = StringCol(validator=validators.ConfirmType(type=str), default='y') name3 = IntCol(validator=validators.Wrapper(fromPython=int), default=100) name4 = FloatCol(default=2.718) @@ -19,23 +20,23 @@ def test_validate(self): t = SOValidation(name='hey') - raises(validators.InvalidField, setattr, t, + raises(validators.Invalid, setattr, t, 'name', '!!!') t.name = 'you' def test_confirmType(self): t = SOValidation(name2='hey') - raises(validators.InvalidField, setattr, t, + raises(validators.Invalid, setattr, t, 'name2', 1) - raises(validators.InvalidField, setattr, t, + raises(validators.Invalid, setattr, t, 'name3', '1') - raises(validators.InvalidField, setattr, t, + raises(validators.Invalid, setattr, t, 'name4', '1') t.name2 = 'you' def test_wrapType(self): t = SOValidation(name3=1) - raises(validators.InvalidField, setattr, t, + raises(validators.Invalid, setattr, t, 'name3', 'x') t.name3 = 1L assert t.name3 == 1 |
From: <sub...@co...> - 2005-08-19 03:09:13
|
Author: ianb Date: 2005-08-19 03:09:06 +0000 (Fri, 19 Aug 2005) New Revision: 920 Modified: trunk/SQLObject/docs/web/links.txt Log: Added a project Modified: trunk/SQLObject/docs/web/links.txt =================================================================== --- trunk/SQLObject/docs/web/links.txt 2005-08-19 03:08:31 UTC (rev 919) +++ trunk/SQLObject/docs/web/links.txt 2005-08-19 03:09:06 UTC (rev 920) @@ -32,6 +32,9 @@ * `Bauble <http://bauble.belizebotanic.org/>`_, a Biodiversity Collection Manager. +* `Anemon <http://anemon.org/wikini/wakka.php?wiki=FirstPage>`_ DHCP + server. + Articles and Documentation -------------------------- |
From: <sub...@co...> - 2005-08-19 03:08:47
|
Author: ianb Date: 2005-08-19 03:08:31 +0000 (Fri, 19 Aug 2005) New Revision: 919 Added: trunk/SQLObject/setup.cfg Log: Make installations from trunk use svn revision Added: trunk/SQLObject/setup.cfg =================================================================== --- trunk/SQLObject/setup.cfg 2005-08-18 07:53:01 UTC (rev 918) +++ trunk/SQLObject/setup.cfg 2005-08-19 03:08:31 UTC (rev 919) @@ -0,0 +1,6 @@ +[easy_install] +#find_links = http://svn.pythonpaste.org/package_index.html + +[egg_info] +tag_build = dev +tag_svn_revision = true |
From: <sub...@co...> - 2005-08-18 19:28:23
|
Author: phd Date: 2005-08-18 07:53:01 +0000 (Thu, 18 Aug 2005) New Revision: 918 Modified: trunk/SQLObject/sqlobject/joins.py Log: Minor patch from michelts <mic...@gm...>. Modified: trunk/SQLObject/sqlobject/joins.py =================================================================== --- trunk/SQLObject/sqlobject/joins.py 2005-08-18 03:13:45 UTC (rev 917) +++ trunk/SQLObject/sqlobject/joins.py 2005-08-18 07:53:01 UTC (rev 918) @@ -238,9 +238,9 @@ class SOSingleJoin(SOMultipleJoin): - def __init__(self, makeDefault=False, **kw): + def __init__(self, **kw): + self.makeDefault = popKey(kw, 'makeDefault', False) SOMultipleJoin.__init__(self, **kw) - self.makeDefault = makeDefault def performJoin(self, inst): pythonColumn = self.soClass.sqlmeta.style.dbColumnToPythonAttr(self.joinColumn) |
From: <sub...@co...> - 2005-08-14 20:48:23
|
Author: phd Date: 2005-08-14 20:48:15 +0000 (Sun, 14 Aug 2005) New Revision: 908 Modified: trunk/SQLObject/sqlobject/main.py Log: Minor patch made by Daniel Berlin. Modified: trunk/SQLObject/sqlobject/main.py =================================================================== --- trunk/SQLObject/sqlobject/main.py 2005-08-14 08:58:46 UTC (rev 907) +++ trunk/SQLObject/sqlobject/main.py 2005-08-14 20:48:15 UTC (rev 908) @@ -1473,7 +1473,7 @@ r = repr(value) if len(r) > 20: value = r[:17] + "..." + r[-1] - items.append((col.name, getattr(self, col.name))) + items.append((col.name, value)) return items def setConnection(cls, value): |
From: <sub...@co...> - 2005-08-12 08:00:03
|
Author: phd Date: 2005-08-12 07:59:51 +0000 (Fri, 12 Aug 2005) New Revision: 902 Modified: trunk/SQLObject/sqlobject/inheritance/iteration.py trunk/SQLObject/sqlobject/inheritance/tests/test_deep_inheritance.py Log: Another patch for deep inheritance from Evandro Vale Miquelito; more tests. Modified: trunk/SQLObject/sqlobject/inheritance/iteration.py =================================================================== --- trunk/SQLObject/sqlobject/inheritance/iteration.py 2005-08-11 22:35:39 UTC (rev 901) +++ trunk/SQLObject/sqlobject/inheritance/iteration.py 2005-08-12 07:59:51 UTC (rev 902) @@ -7,22 +7,8 @@ defaultArraySize = 10000 def __init__(self, dbconn, rawconn, select, keepConnection=False): - # unless we do a lazy select, replace sourceClass - # with the root of the inheritance tree (children - # will be attached by sourceClass.get) - lazyColumns = select.ops.get('lazyColumns', False) - sourceClass = select.sourceClass - if sourceClass._parentClass and not lazyColumns: - addClauses = [] - while sourceClass._parentClass: - addClauses.append(sourceClass._parentClass.q.childName - == sourceClass.__name__) - sourceClass = sourceClass._parentClass - select = select.__class__(sourceClass, - sqlbuilder.AND(select.clause, *addClauses), - select.clauseTables, **select.ops) super(InheritableIteration, self).__init__(dbconn, rawconn, select, keepConnection) - self.lazyColumns = lazyColumns + self.lazyColumns = select.ops.get('lazyColumns', False) self.cursor.arraysize = self.defaultArraySize self._results = [] # Find the index of the childName column Modified: trunk/SQLObject/sqlobject/inheritance/tests/test_deep_inheritance.py =================================================================== --- trunk/SQLObject/sqlobject/inheritance/tests/test_deep_inheritance.py 2005-08-11 22:35:39 UTC (rev 901) +++ trunk/SQLObject/sqlobject/inheritance/tests/test_deep_inheritance.py 2005-08-12 07:59:51 UTC (rev 902) @@ -29,5 +29,11 @@ position='Project leader', manager=manager) person = DIPerson(firstName='Oneof', lastName='Authors', manager=manager) + managers = list(DIManager.select()) + assert len(managers) == 1 + + employees = list(DIEmployee.select()) + assert len(employees) == 2 + persons = list(DIPerson.select()) assert len(persons) == 3 |
From: <sub...@co...> - 2005-08-11 16:08:33
|
Author: phd Date: 2005-08-11 16:08:28 +0000 (Thu, 11 Aug 2005) New Revision: 900 Added: trunk/SQLObject/sqlobject/inheritance/tests/test_deep_inheritance.py Modified: trunk/SQLObject/sqlobject/inheritance/__init__.py Log: Applied a patch made by Evandro Vale Miquelito - fix bugs in deep inheritance. Reworked the patch to be in sync with sqlmeta changes. Added a test for deep inheritance. Modified: trunk/SQLObject/sqlobject/inheritance/__init__.py =================================================================== --- trunk/SQLObject/sqlobject/inheritance/__init__.py 2005-08-11 16:03:38 UTC (rev 899) +++ trunk/SQLObject/sqlobject/inheritance/__init__.py 2005-08-11 16:08:28 UTC (rev 900) @@ -1,6 +1,7 @@ from sqlobject import sqlbuilder from sqlobject import classregistry -from sqlobject.main import SQLObject, SelectResults, True, False, makeProperties, getterName, setterName +from sqlobject.main import sqlmeta, SQLObject, SelectResults, True, False, \ + makeProperties, getterName, setterName import iteration @@ -64,120 +65,128 @@ **ops) -class InheritableSQLObject(SQLObject): - _inheritable = True - SelectResultsClass = InheritableSelectResults - - def get(cls, id, connection=None, selectResults=None, childResults=None, childUpdate=False): - - val = super(InheritableSQLObject, cls).get(id, connection, selectResults) - - #DSM: If we are updating a child, we should never return a child... - if childUpdate: return val - #DSM: If this class has a child, return the child - if hasattr(val, 'childName'): - childName = val.childName - if childName is not None: - return val._childClasses[childName].get(id, connection=connection, selectResults=childResults) - #DSM: Now, we know we are alone or the last child in a family... - #DSM: It's time to find our parents - inst = val - while inst._parentClass and not inst._parent: - inst._parent = inst._parentClass.get(id, connection=connection, childUpdate=True) - inst = inst._parent - #DSM: We can now return ourself - return val - - get = classmethod(get) - - def addColumn(cls, columnDef, changeSchema=False, connection=None, childUpdate=False): +class InheritableSQLMeta(sqlmeta): + def addColumn(sqlmeta, columnDef, changeSchema=False, connection=None, childUpdate=False): + soClass = sqlmeta.soClass #DSM: Try to add parent properties to the current class #DSM: Only do this once if possible at object creation and once for #DSM: each new dynamic column to refresh the current class - if childUpdate or cls._parentClass: - for col in cls._parentClass.sqlmeta.columnList: + if childUpdate or soClass._parentClass: + for col in soClass._parentClass.sqlmeta.columnList: cname = col.name if cname == 'childName': continue - setattr(cls, getterName(cname), eval( + setattr(soClass, getterName(cname), eval( 'lambda self: self._parent.%s' % cname)) if not col.immutable: - setattr(cls, setterName(cname), eval( + setattr(soClass, setterName(cname), eval( 'lambda self, val: setattr(self._parent, %s, val)' % repr(cname))) if childUpdate: - makeProperties(cls) + makeProperties(soClass) return if columnDef: - super(InheritableSQLObject, cls).addColumn(columnDef, changeSchema, connection) + super(InheritableSQLMeta, sqlmeta).addColumn(columnDef, changeSchema, connection) #DSM: Update each child class if needed and existing (only for new #DSM: dynamic column as no child classes exists at object creation) - for c in cls._childClasses.values(): - c.addColumn(columnDef, connection=connection, childUpdate=True) + for c in soClass._childClasses.values(): + c.sqlmeta.addColumn(columnDef, connection=connection, childUpdate=True) addColumn = classmethod(addColumn) - def delColumn(cls, column, changeSchema=False, connection=None): - super(InheritableSQLObject, cls).delColumn(column, changeSchema, connection) + def delColumn(sqlmeta, column, changeSchema=False, connection=None): + soClass = sqlmeta.soClass + super(InheritableSQLMeta, sqlmeta).delColumn(column, changeSchema, connection) #DSM: Update each child class if needed #DSM: and delete properties for this column - for c in cls._childClasses.values(): + for c in soClass._childClasses.values(): delattr(c, name) delColumn = classmethod(delColumn) - def addJoin(cls, joinDef, childUpdate=False): + def addJoin(sqlmeta, joinDef, childUpdate=False): + soClass = sqlmeta.soClass #DSM: Try to add parent properties to the current class #DSM: Only do this once if possible at object creation and once for #DSM: each new dynamic join to refresh the current class - if childUpdate or cls._parentClass: - for jdef in cls._parentClass.sqlmeta.joins: - join = jdef.withClass(cls) + if childUpdate or soClass._parentClass: + for jdef in soClass._parentClass.sqlmeta.joins: + join = jdef.withClass(soClass) jname = join.joinMethodName jarn = join.addRemoveName - setattr(cls, getterName(jname), + setattr(soClass, getterName(jname), eval('lambda self: self._parent.%s' % jname)) if hasattr(join, 'remove'): - setattr(cls, 'remove' + jarn, + setattr(soClass, 'remove' + jarn, eval('lambda self,o: self._parent.remove%s(o)' % jarn)) if hasattr(join, 'add'): - setattr(cls, 'add' + jarn, + setattr(soClass, 'add' + jarn, eval('lambda self,o: self._parent.add%s(o)' % jarn)) if childUpdate: - makeProperties(cls) + makeProperties(soClass) return if joinDef: - super(InheritableSQLObject, cls).addJoin(joinDef) + super(InheritableSQLMeta, sqlmeta).addJoin(joinDef) #DSM: Update each child class if needed and existing (only for new #DSM: dynamic join as no child classes exists at object creation) - for c in cls._childClasses.values(): - c.addJoin(joinDef, childUpdate=True) + for c in soClass._childClasses.values(): + c.sqlmeta.addJoin(joinDef, childUpdate=True) addJoin = classmethod(addJoin) - def delJoin(cls, joinDef): - super(InheritableSQLObject, cls).delJoin(joinDef) + def delJoin(sqlmeta, joinDef): + soClass = sqlmeta.soClass + super(InheritableSQLMeta, sqlmeta).delJoin(joinDef) #DSM: Update each child class if needed #DSM: and delete properties for this join - for c in cls._childClasses.values(): + for c in soClass._childClasses.values(): delattr(c, meth) delJoin = classmethod(delJoin) + +class InheritableSQLObject(SQLObject): + + sqlmeta = InheritableSQLMeta + _inheritable = True + SelectResultsClass = InheritableSelectResults + + def get(cls, id, connection=None, selectResults=None, childResults=None, childUpdate=False): + + val = super(InheritableSQLObject, cls).get(id, connection, selectResults) + + #DSM: If we are updating a child, we should never return a child... + if childUpdate: return val + #DSM: If this class has a child, return the child + if hasattr(val, 'childName'): + childName = val.childName + if childName is not None: + return val._childClasses[childName].get(id, connection=connection, selectResults=childResults) + #DSM: Now, we know we are alone or the last child in a family... + #DSM: It's time to find our parents + inst = val + while inst._parentClass and not inst._parent: + inst._parent = inst._parentClass.get(id, connection=connection, childUpdate=True) + inst = inst._parent + #DSM: We can now return ourself + return val + + get = classmethod(get) + def _notifyFinishClassCreation(cls): if not cls.sqlmeta.columnList: # There are no columns - call addColumn to propagate columns # from parent classes to children - cls.addColumn(None) + cls.sqlmeta.addColumn(None) if not cls.sqlmeta.joins: # There are no joins - call addJoin to propagate joins # from parent classes to children - cls.addJoin(None) + cls.sqlmeta.addJoin(None) _notifyFinishClassCreation = classmethod(_notifyFinishClassCreation) def _create(self, id, **kw): @@ -194,14 +203,16 @@ if self._parentClass: parentClass = self._parentClass new_kw = {} - parent_kw = {'childName': self.__class__.__name__} + parent_kw = {} for (name, value) in kw.items(): - if hasattr(parentClass, name): - parent_kw[name] = value - else: - new_kw[name] = value + if hasattr(parentClass, name): + parent_kw[name] = value + else: + new_kw[name] = value kw = new_kw self._parent = parentClass(kw=parent_kw, connection=self._connection) + self._parent.childName = self.__class__.__name__ + id = self._parent.id super(InheritableSQLObject, self)._create(id, **kw) Added: trunk/SQLObject/sqlobject/inheritance/tests/test_deep_inheritance.py =================================================================== --- trunk/SQLObject/sqlobject/inheritance/tests/test_deep_inheritance.py 2005-08-11 16:03:38 UTC (rev 899) +++ trunk/SQLObject/sqlobject/inheritance/tests/test_deep_inheritance.py 2005-08-11 16:08:28 UTC (rev 900) @@ -0,0 +1,33 @@ +from sqlobject import * +from sqlobject.tests.dbtest import * +from sqlobject.inheritance import InheritableSQLObject + +######################################## +## Deep Inheritance +######################################## + + +class DIPerson(InheritableSQLObject): + firstName = StringCol() + lastName = StringCol(alternateID=True) + manager = ForeignKey("DIManager", default=None) + +class DIEmployee(DIPerson): + position = StringCol() + +class DIManager(DIEmployee): + subdudes = MultipleJoin("DIPerson", joinColumn="manager_id") + +def test_deep_inheritance(): + setupClass(DIManager) + setupClass(DIEmployee) + setupClass(DIPerson) + + manager = DIManager(firstName='Project', lastName='Manager', + position='Project Manager') + employee = DIEmployee(firstName='Project', lastName='Leader', + position='Project leader', manager=manager) + person = DIPerson(firstName='Oneof', lastName='Authors', manager=manager) + + persons = list(DIPerson.select()) + assert len(persons) == 3 |
From: <sub...@co...> - 2005-08-11 16:03:50
|
Author: phd Date: 2005-08-11 16:03:38 +0000 (Thu, 11 Aug 2005) New Revision: 899 Modified: trunk/SQLObject/sqlobject/inheritance/tests/test_inheritance.py Log: Renamed InherPerson to InheritablePerson. Modified: trunk/SQLObject/sqlobject/inheritance/tests/test_inheritance.py =================================================================== --- trunk/SQLObject/sqlobject/inheritance/tests/test_inheritance.py 2005-08-11 06:27:21 UTC (rev 898) +++ trunk/SQLObject/sqlobject/inheritance/tests/test_inheritance.py 2005-08-11 16:03:38 UTC (rev 899) @@ -7,28 +7,28 @@ ######################################## -class InherPerson(InheritableSQLObject): +class InheritablePerson(InheritableSQLObject): firstName = StringCol() lastName = StringCol(alternateID=True) -class Employee(InherPerson): +class Employee(InheritablePerson): _inheritable = False position = StringCol() def setup(): - setupClass(InherPerson) + setupClass(InheritablePerson) setupClass(Employee) Employee(firstName='Project', lastName='Leader', position='Project leader') - InherPerson(firstName='Oneof', lastName='Authors') + InheritablePerson(firstName='Oneof', lastName='Authors') def test_inheritance(): setup() - persons = InherPerson.select() # all + persons = InheritablePerson.select() # all for person in persons: - assert isinstance(person, InherPerson) + assert isinstance(person, InheritablePerson) if isinstance(person, Employee): assert not hasattr(person, "childName") else: @@ -39,10 +39,10 @@ def test_inheritance_select(): setup() - persons = InherPerson.select(InherPerson.q.firstName <> None) + persons = InheritablePerson.select(InheritablePerson.q.firstName <> None) assert persons.count() == 2 - persons = InherPerson.select(InherPerson.q.firstName == "phd") + persons = InheritablePerson.select(InheritablePerson.q.firstName == "phd") assert persons.count() == 0 employees = Employee.select(Employee.q.firstName <> None) @@ -54,7 +54,7 @@ employees = Employee.select(Employee.q.position <> None) assert employees.count() == 1 - persons = InherPerson.selectBy(firstName="Project") + persons = InheritablePerson.selectBy(firstName="Project") assert persons.count() == 1 assert isinstance(persons[0], Employee) @@ -62,13 +62,13 @@ assert persons.count() == 1 try: - person = InherPerson.byLastName("Oneof") + person = InheritablePerson.byLastName("Oneof") except: pass else: raise RuntimeError, "unknown person %s" % person - person = InherPerson.byLastName("Leader") + person = InheritablePerson.byLastName("Leader") assert person.firstName == "Project" person = Employee.byLastName("Leader") |
From: <sub...@co...> - 2005-08-05 22:08:08
|
Author: test Date: 2005-08-05 22:07:46 +0000 (Fri, 05 Aug 2005) New Revision: 897 Modified: trunk/SQLObject/sqlobject/col.py trunk/SQLObject/sqlobject/tests/test_basic.py Log: Allow attributes to be set on Col object, then propogated to the SOCol objects Modified: trunk/SQLObject/sqlobject/col.py =================================================================== --- trunk/SQLObject/sqlobject/col.py 2005-08-05 21:14:27 UTC (rev 896) +++ trunk/SQLObject/sqlobject/col.py 2005-08-05 22:07:46 UTC (rev 897) @@ -121,7 +121,8 @@ lazy=False, noCache=False, forceDBName=False, - origName=None): + origName=None, + extra_vars=None): # This isn't strictly true, since we *could* use backquotes or # " or something (database-specific) around column names, but @@ -213,6 +214,10 @@ # and append an ID self.origName = origName or name + if extra_vars: + for name, value in extra_vars.items(): + setattr(self, name, value) + def _set_validator(self, value): self._validator = value if self._validator: @@ -363,16 +368,16 @@ baseClass = SOCol def __init__(self, name=None, **kw): - self._name = name - kw['columnDef'] = self - self.kw = kw - self.creationOrder = creationOrder.next() + self.__dict__['_name'] = name + self.__dict__['_kw'] = kw + self.__dict__['creationOrder'] = creationOrder.next() + self.__dict__['_extra_vars'] = {} def _set_name(self, value): assert self._name is None or self._name == value, ( "You cannot change a name after it has already been set " "(from %s to %s)" % (self.name, value)) - self._name = value + self.__dict__['_name'] = value def _get_name(self): return self._name @@ -382,8 +387,16 @@ def withClass(self, soClass): return self.baseClass(soClass=soClass, name=self._name, creationOrder=self.creationOrder, - **self.kw) + columnDef=self, + extra_vars=self._extra_vars, + **self._kw) + def __setattr__(self, var, value): + if var == 'name': + super(Col, self).__setattr__(var, value) + return + self._extra_vars[var] = value + def __repr__(self): return '<%s %s %s>' % ( self.__class__.__name__, hex(abs(id(self)))[2:], @@ -848,7 +861,8 @@ def __init__(self, **kw): datetimeFormat = popKey(kw, 'datetimeFormat') - if datetimeFormat: self.datetimeFormat = datetimeFormat + if datetimeFormat: + self.datetimeFormat = datetimeFormat SOCol.__init__(self, **kw) def createValidators(self): Modified: trunk/SQLObject/sqlobject/tests/test_basic.py =================================================================== --- trunk/SQLObject/sqlobject/tests/test_basic.py 2005-08-05 21:14:27 UTC (rev 896) +++ trunk/SQLObject/sqlobject/tests/test_basic.py 2005-08-05 22:07:46 UTC (rev 897) @@ -4,6 +4,8 @@ class TestSO1(SQLObject): name = StringCol(length=50, dbName='name_col') + name.title = 'Your Name' + name.foobar = 1 passwd = StringCol(length=10) class sqlmeta: @@ -50,6 +52,13 @@ bob.set(name='joebob', passwd='testtest') assert bob.name == 'joebob' +def test_extra_vars(): + setupGetters(TestSO1) + col = TestSO1.sqlmeta.columns['name'] + assert col.title == 'Your Name' + assert col.foobar == 1 + assert getattr(TestSO1.sqlmeta.columns['passwd'], 'title', None) is None + class TestSO2(SQLObject): name = StringCol(length=50, dbName='name_col') passwd = StringCol(length=10) |
From: <sub...@co...> - 2005-08-05 21:14:32
|
Author: test Date: 2005-08-05 21:14:27 +0000 (Fri, 05 Aug 2005) New Revision: 896 Modified: trunk/SQLObject/docs/SQLObject.txt Log: Expanded slightly; fixed up docstring tests Modified: trunk/SQLObject/docs/SQLObject.txt =================================================================== --- trunk/SQLObject/docs/SQLObject.txt 2005-08-05 21:14:00 UTC (rev 895) +++ trunk/SQLObject/docs/SQLObject.txt 2005-08-05 21:14:27 UTC (rev 896) @@ -125,12 +125,16 @@ >>> db_filename = os.path.abspath('data.db') >>> if os.path.exists(db_filename): ... os.unlink(db_filename) - >>> sqlhub.processConnection = connectionForURI( - ... 'sqlite:' + db_filename) + >>> connection_string = 'sqlite:' + db_filename + >>> connection = connectionForURI(connection_string) + >>> sqlhub.processConnection = connection +The ``sqlhub.processConnection`` assignment means that all classes +will, by default, use this connection we've just set up. + We'll develop a simple addressbook-like database. We could create the -tables ourselves, and just have SQLObject access those tables, but for -now we'll let SQLObject do that work. First, the class: +tables ourselves, and just have SQLObject access those tables, but +let's have SQLObject do that work. First, the class: >>> class Person(SQLObject): ... @@ -149,37 +153,32 @@ last_name TEXT ); -This is for MySQL. The schema for other databases looks slightly -different (especially the ``id`` column). You'll notice the names -were changed from mixedCase to underscore_separated -- this is done by -the `style object`_. There are a variety of ways to handle that names -that don't fit conventions (see `Irregular Naming`_). +This is for SQLite or MySQL. The schema for other databases looks +slightly different (especially the ``id`` column). You'll notice the +names were changed from mixedCase to underscore_separated -- this is +done by the `style object`_. There are a variety of ways to handle +names that don't fit conventions (see `Irregular Naming`_). .. _`style object`: `Changing the Naming Style`_ -The tables don't yet exist. We'll let SQLObject create them:: +Now we'll create the table in the database:: >>> Person.createTable() We can change the type of the various columns by using something other than `StringCol`, or using different arguments. More about this in -`Subclasses of Col`_. +`Column Types`_. -If you don't want to do table creation (you already have tables, or -you want to create the tables yourself), you can just use the vague -`Col` class. SQLObject doesn't do much type checking, allowing the -database and the adapter to handle most of the type conversion. -Databases generally do their own type coercion on inputs. - You'll note that the ``id`` column is not given in the class definition, it is implied. For MySQL databases it should be defined as ``INT PRIMARY KEY AUTO_INCREMENT``, in Postgres ``SERIAL PRIMARY -KEY``, and in SQLite as ``INTEGER PRIMARY KEY``. You can `override -the name`__, but some immutable primary key must exist (`you can use -non-integer keys`_ with some extra effort). +KEY``, and in SQLite as ``INTEGER PRIMARY KEY``. You can't use tables +with SQLObject that don't have a single primary key, and you must +treat that key as immutable (otherwise you'll confuse SQLObject +terribly). -__ idName_ -.. _`you can use non-integer keys`: `Non-Integer Keys`_ +You can `override the id name`__ in the database, but it is always +called ``.id`` from Python. Using the Class --------------- @@ -190,29 +189,40 @@ To create a new object (and row), use class instantiation, like:: >>> Person(firstName="John", lastName="Doe") - <Person 1 lastName='Doe' middleInitial=None firstName='John'> + <Person 1 firstName='John' middleInitial=None lastName='Doe'> +.. note:: + + In SQLObject NULL/None does *not* mean default. NULL is a funny + thing; it mean very different things in different contexts and to + different people. Sometimes it means "default", sometimes "not + applicable", sometimes "unknown". If you want a default, NULL or + otherwise, you always have to be explicit in your class + definition. + + Also note that the SQLObject default isn't the same as the + database's default (SQLObject never uses the database's default). + If you had left out ``firstName`` or ``lastName`` you would have gotten an error, as no default was given for these columns (``middleInitial`` has a default, so it will be set to ``NULL``, the -SQL equivalent of ``None``). +database equivalent of ``None``). You can use the class method `.get()` to fetch instances that already exist:: >>> Person.get(1) - <Person 1 lastName='Doe' middleInitial=None firstName='John'> + <Person 1 firstName='John' middleInitial=None lastName='Doe'> When you create an object, it is immediately inserted into the -database. SQLObject generally uses the database as immediate storage, -unlike some other systems where you explicitly save objects into a -database. +database. SQLObject uses the database as immediate storage, unlike +some other systems where you explicitly save objects into a database. Here's a longer example of using the class:: >>> p = Person.get(1) >>> p - <Person 1 lastName='Doe' middleInitial=None firstName='John'> + <Person 1 firstName='John' middleInitial=None lastName='Doe'> >>> p.firstName 'John' >>> p.middleInitial = 'Q' @@ -220,22 +230,10 @@ 'Q' >>> p2 = Person.get(1) >>> p2 - <Person 1 lastName='Doe' middleInitial='Q' firstName='John'> + <Person 1 firstName='John' middleInitial='Q' lastName='Doe'> >>> p is p2 True -.. note:: - - In SQLObject NULL/None does *not* mean default. NULL is a funny - thing; it mean very different things in different contexts and to - different people. Sometimes it means "default", sometimes "not - applicable", sometimes "unknown". If you want a default, NULL or - otherwise, you always have to be explicit in your class - definition. - - Also note that the SQLObject default isn't the same as the - database's default (SQLObject never uses the database's default). - Columns are accessed like attributes. (This uses the ``property`` feature of Python 2.2, so that retrieving and setting these attributes executes code). Also note that objects are unique -- there is @@ -255,10 +253,10 @@ >>> p = Person(firstName='Bob', lastName='Hope') 1/QueryIns: INSERT INTO person (last_name, middle_initial, first_name) VALUES ('Hope', NULL, 'Bob') 1/COMMIT : auto - 1/QueryOne: SELECT last_name, middle_initial, first_name FROM person WHERE id = 2 + 1/QueryOne: SELECT first_name, middle_initial, last_name FROM person WHERE id = 2 1/COMMIT : auto >>> p - <Person 2 lastName='Hope' middleInitial=None firstName='Bob'> + <Person 2 firstName='Bob' middleInitial=None lastName='Hope'> >>> p.middleInitial = 'Q' 1/Query : UPDATE person SET middle_initial = 'Q' WHERE id = 2 1/COMMIT : auto @@ -297,13 +295,14 @@ refetches the data from the database, which ``.syncUpdate()`` does not do. -When enabled instances will have a property ``dirty``, which indicates -if there are pending updates. Inserts are still done immediately. +When enabled instances will have a property ``.sqlmeta.dirty``, which +indicates if there are pending updates. Inserts are still done +immediately; there's no way to do lazy inserts at this time. One-to-Many Relationships ------------------------- -A real address book should have people, but also addresses. +An address book is nothing without addresses. First, let's define the new address table. People can have multiple addresses, of course:: @@ -319,10 +318,24 @@ Note the column ``person = ForeignKey("Person")``. This is a reference to a `Person` object. We refer to other classes by name -(with a string) to avoid circular dependencies. In the database -there will be a ``person_id`` column, type ``INT``, which points to -the ``person`` column. +(with a string). In the database there will be a ``person_id`` +column, type ``INT``, which points to the ``person`` column. +.. note:: + + The reason SQLObject uses strings to refer to other classes is + because the other class often does not yet exist. Classes in + Python are *created*, not *declared*; so when a module is imported + the commands are executed. ``class`` is just another command; one + that creates a class and assigns it to the name you give. + + If class ``A`` referred to class ``B``, but class ``B`` was defined + below ``A`` in the module, then when the ``A`` class was created + (including creating all its column attributes) the ``B`` class + simply wouldn't exist. By referring to classes by name, we can + wait until all the requird classes exist before creating the links + between classes. + We want an attribute that gives the addresses for a person. In a class definition we'd do:: @@ -333,15 +346,15 @@ But we already have the class. We can add this to the class in-place:: - >>> Person.addJoin(MultipleJoin('Address', - ... joinMethodName='addresses')) + >>> Person.sqlmeta.addJoin(MultipleJoin('Address', + ... joinMethodName='addresses')) .. note:: In almost all cases you can modify SQLObject classes after they've - been created. Having attributes like ``*Col`` objects is - equivalent to calling certain class methods (like - ``addColumn()``). + been created. Having attributes that contain ``*Col`` objects in + the class definition is equivalent to calling certain class methods + (like ``addColumn()``). Now we can get the backreference with ``aPerson.addresses``, which returns a list. An example:: @@ -453,8 +466,9 @@ >>> Person._connection.debug = True >>> peeps = Person.select(Person.q.firstName=="John") >>> list(peeps) - SELECT person.id FROM person WHERE person.first_name = 'John'; - [<Person 1 lastName='Doe' middleInitial=None firstName='John'>] + 1/Select : SELECT person.id, person.first_name, person.middle_initial, person.last_name FROM person WHERE (person.first_name = 'John') + 1/COMMIT : auto + [<Person 1 firstName='John' middleInitial='Q' lastName='Doe'>] This example returns everyone with the first name John. An expression could be more complicated as well, like:: @@ -463,7 +477,8 @@ ... AND(Address.q.personID == Person.q.id, ... Address.q.zip.startswith('504'))) >>> list(peeps) - SELECT person.id FROM person, address WHERE (address.person_id = person.id AND address.zip LIKE '612%'); + 1/Select : SELECT person.id, person.first_name, person.middle_initial, person.last_name FROM person, address WHERE ((address.person_id = person.id) AND (address.zip LIKE '504%')) + 1/COMMIT : auto [] You'll note that classes have an attribute ``q``, which gives access @@ -754,8 +769,8 @@ work it's sometimes easiest just to use `sqlType`. Only necessary if SQLObject is creating your tables. -Subclasses of Col -~~~~~~~~~~~~~~~~~ +Column Types +~~~~~~~~~~~~ The `ForeignKey` class should be used instead of `Col` when the column is a reference to another table/class. It is generally used like |
From: <sub...@co...> - 2005-08-05 21:14:04
|
Author: test Date: 2005-08-05 21:14:00 +0000 (Fri, 05 Aug 2005) New Revision: 895 Modified: trunk/SQLObject/docs/FAQ.txt Log: Added entry on lazy updates and inserts Modified: trunk/SQLObject/docs/FAQ.txt =================================================================== --- trunk/SQLObject/docs/FAQ.txt 2005-08-05 21:13:42 UTC (rev 894) +++ trunk/SQLObject/docs/FAQ.txt 2005-08-05 21:14:00 UTC (rev 895) @@ -378,3 +378,15 @@ column. See `Irregular Naming`_ in the documentation. .. _Irregular Naming: SQLObject.html#irregular-naming + +Lazy Updates and Insert +----------------------- + +`Lazy updates <SQLObject.html#lazy-updates>`_ allow you to defer +sending ``UPDATES`` until you synchronize the object. However, there +is no way to do a lazy insert; as soon as you create an instance the +``INSERT`` is executed. + +The reason for this limit is that each object needs a database ID, and +in many databases you cannot attain an ID until you create a row. + |
From: <sub...@co...> - 2005-08-05 21:13:50
|
Author: test Date: 2005-08-05 21:13:42 +0000 (Fri, 05 Aug 2005) New Revision: 894 Modified: trunk/SQLObject/docs/test.py Log: Make sure checkout is first on sys.path Modified: trunk/SQLObject/docs/test.py =================================================================== --- trunk/SQLObject/docs/test.py 2005-08-05 21:03:11 UTC (rev 893) +++ trunk/SQLObject/docs/test.py 2005-08-05 21:13:42 UTC (rev 894) @@ -5,7 +5,8 @@ else: raise ImportError("Python 2.4 doctest required") -sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) +sys.path.insert( + 0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) def test(): for doc in ['SQLObject.txt']: |
From: <sub...@co...> - 2005-08-05 20:23:41
|
Author: test Date: 2005-08-05 20:23:19 +0000 (Fri, 05 Aug 2005) New Revision: 892 Modified: trunk/SQLObject/docs/SQLObject.txt trunk/SQLObject/docs/TODO.txt Log: Moved some stuff around, trimmed a little excess Modified: trunk/SQLObject/docs/SQLObject.txt =================================================================== --- trunk/SQLObject/docs/SQLObject.txt 2005-08-05 04:04:47 UTC (rev 891) +++ trunk/SQLObject/docs/SQLObject.txt 2005-08-05 20:23:19 UTC (rev 892) @@ -7,8 +7,8 @@ Author, Site, and License ========================= -SQLObject is by Ian Bicking (ia...@co...). The website is -sqlobject.org__. +SQLObject is by Ian Bicking (ia...@co...) and `Contributors +<Authors.html>`_. The website is sqlobject.org__. __ http://sqlobject.org @@ -108,29 +108,6 @@ does not have to be designed with SQLObject in mind, and the resulting classes do not have to inherit the database's naming schemes. -Future -====== - -Here are some things I plan: - -* More databases supported. There has been interest and some work in - the progress for Oracle, Sybase, and MS-SQL support. -* Better transaction support -- right now you can use transactions - for the database, but the object isn't transaction-aware, so - non-database persistence won't be able to be rolled back. -* Optimistic locking and other techniques to handle concurrency. -* Profile of SQLObject performance, so that I can identify bottlenecks. -* Increase hooks with FormEncode (unreleased) validation and form - generation package, so SQLObject classes (read: schemas) can be - published for editing more directly and easily. -* Automatic joins in select queries. -* More kinds of joins, and more powerful join results (closer to how - `select` works). - -See also the `Plan for 0.6`__. - -.. __: Plan06.html - Using SQLObject: An Introduction ================================ @@ -220,18 +197,6 @@ (``middleInitial`` has a default, so it will be set to ``NULL``, the SQL equivalent of ``None``). -.. note:: - - In SQLObject NULL/None does *not* mean default. NULL is a funny - thing; it mean very different things in different contexts and to - different people. Sometimes it means "default", sometimes "not - applicable", sometimes "unknown". If you want a default, NULL or - otherwise, you always have to be explicit in your class - definition. - - Also note that the SQLObject default isn't the same as the - database's default (SQLObject never uses the database's default). - You can use the class method `.get()` to fetch instances that already exist:: @@ -259,6 +224,18 @@ >>> p is p2 True +.. note:: + + In SQLObject NULL/None does *not* mean default. NULL is a funny + thing; it mean very different things in different contexts and to + different people. Sometimes it means "default", sometimes "not + applicable", sometimes "unknown". If you want a default, NULL or + otherwise, you always have to be explicit in your class + definition. + + Also note that the SQLObject default isn't the same as the + database's default (SQLObject never uses the database's default). + Columns are accessed like attributes. (This uses the ``property`` feature of Python 2.2, so that retrieving and setting these attributes executes code). Also note that objects are unique -- there is Modified: trunk/SQLObject/docs/TODO.txt =================================================================== --- trunk/SQLObject/docs/TODO.txt 2005-08-05 04:04:47 UTC (rev 891) +++ trunk/SQLObject/docs/TODO.txt 2005-08-05 20:23:19 UTC (rev 892) @@ -1,10 +1,19 @@ TODO ---- -See also some `long-term ideas`__. - -.. __: Plan06.html - * ``_fromDatabase`` currently doesn't support IDs that don't fit into the normal naming scheme. It should do so. You can still use ``_idName`` with ``_fromDatabase``. +* More databases supported. There has been interest and some work in + the progress for Oracle, Sybase, and MS-SQL support. +* Better transaction support -- right now you can use transactions + for the database, but the object isn't transaction-aware, so + non-database persistence won't be able to be rolled back. +* Optimistic locking and other techniques to handle concurrency. +* Profile of SQLObject performance, so that I can identify bottlenecks. +* Increase hooks with FormEncode (unreleased) validation and form + generation package, so SQLObject classes (read: schemas) can be + published for editing more directly and easily. +* Automatic joins in select queries. +* More kinds of joins, and more powerful join results (closer to how + `select` works). |
From: <sub...@co...> - 2005-08-05 04:00:56
|
Author: ianb Date: 2005-08-05 04:00:47 +0000 (Fri, 05 Aug 2005) New Revision: 890 Modified: trunk/SQLObject/scripts/sqlobject-admin Log: Added attempt at require() Modified: trunk/SQLObject/scripts/sqlobject-admin =================================================================== --- trunk/SQLObject/scripts/sqlobject-admin 2005-08-04 08:05:37 UTC (rev 889) +++ trunk/SQLObject/scripts/sqlobject-admin 2005-08-05 04:00:47 UTC (rev 890) @@ -1,7 +1,15 @@ #!/usr/bin/env python import sys import os + try: + import pkg_resources + pkg_resources.require('SQLObject>=0.7') +except (ImportError, pkg_resources.DistributionNotFound): + # Oh well, we tried... + pass + +try: import sqlobject.manager except ImportError: try: |
From: <sub...@co...> - 2005-08-04 08:05:45
|
Author: phd Date: 2005-08-04 08:05:37 +0000 (Thu, 04 Aug 2005) New Revision: 889 Modified: trunk/SQLObject/sqlobject/inheritance/__init__.py Log: Applied a patch made by Evandro Vale Miquelito: pass the connection to the parentClass. Modified: trunk/SQLObject/sqlobject/inheritance/__init__.py =================================================================== --- trunk/SQLObject/sqlobject/inheritance/__init__.py 2005-08-04 03:49:10 UTC (rev 888) +++ trunk/SQLObject/sqlobject/inheritance/__init__.py 2005-08-04 08:05:37 UTC (rev 889) @@ -201,7 +201,7 @@ else: new_kw[name] = value kw = new_kw - self._parent = parentClass(kw=parent_kw) + self._parent = parentClass(kw=parent_kw, connection=self._connection) id = self._parent.id super(InheritableSQLObject, self)._create(id, **kw) |
From: <sub...@co...> - 2005-08-03 00:01:52
|
Author: ianb Date: 2005-08-03 00:01:45 +0000 (Wed, 03 Aug 2005) New Revision: 887 Modified: trunk/SQLObject/docs/web/links.txt Log: Fixed syntax Modified: trunk/SQLObject/docs/web/links.txt =================================================================== --- trunk/SQLObject/docs/web/links.txt 2005-08-02 15:19:05 UTC (rev 886) +++ trunk/SQLObject/docs/web/links.txt 2005-08-03 00:01:45 UTC (rev 887) @@ -22,7 +22,7 @@ * `Teeny Tiny CMS <http://footils.org/cms/show/3>`_. * `rdflib <http://rdflib.net/>`_ contains a `SQLObject backend - <http://svn.rdflib.net/trunk/rdflib/backends/_sqlobject.py>_. + <http://svn.rdflib.net/trunk/rdflib/backends/_sqlobject.py>`_. * Enfold Systems' `EnTransit <http://www.enfoldsystems.com/About/Talks/entransit-tutorial.pdf>`_ |
From: <sub...@co...> - 2005-08-02 15:19:09
|
Author: test Date: 2005-08-02 15:19:05 +0000 (Tue, 02 Aug 2005) New Revision: 886 Modified: trunk/SQLObject/docs/web/links.txt Log: Added another project Modified: trunk/SQLObject/docs/web/links.txt =================================================================== --- trunk/SQLObject/docs/web/links.txt 2005-08-02 15:16:27 UTC (rev 885) +++ trunk/SQLObject/docs/web/links.txt 2005-08-02 15:19:05 UTC (rev 886) @@ -29,6 +29,9 @@ utilizes SQLObject and rdflib for storing transactional content from Zope. +* `Bauble <http://bauble.belizebotanic.org/>`_, a Biodiversity + Collection Manager. + Articles and Documentation -------------------------- |
From: <sub...@co...> - 2005-08-02 15:16:41
|
Author: test Date: 2005-08-02 15:16:27 +0000 (Tue, 02 Aug 2005) New Revision: 885 Modified: trunk/SQLObject/docs/web/links.txt Log: Added link contributed by Philippe Normand Modified: trunk/SQLObject/docs/web/links.txt =================================================================== --- trunk/SQLObject/docs/web/links.txt 2005-08-02 04:48:56 UTC (rev 884) +++ trunk/SQLObject/docs/web/links.txt 2005-08-02 15:16:27 UTC (rev 885) @@ -45,3 +45,6 @@ <http://ianbicking.org/docs/sqlobject-presentation/sqlobject-and-database-programming.html>`_; slides from a presentation on SQLObject. +* `Connecting databases to Python with SQLObject + <http://www-128.ibm.com/developerworks/library/os-pythonsqlo/index.html?ca=drs>`_; + an article at DeveloperWorks. |
From: <sub...@co...> - 2005-08-02 04:08:49
|
Author: ianb Date: 2005-08-02 04:08:41 +0000 (Tue, 02 Aug 2005) New Revision: 881 Modified: trunk/SQLObject/docs/web/index.txt Log: Fixed link Modified: trunk/SQLObject/docs/web/index.txt =================================================================== --- trunk/SQLObject/docs/web/index.txt 2005-08-02 04:08:19 UTC (rev 880) +++ trunk/SQLObject/docs/web/index.txt 2005-08-02 04:08:41 UTC (rev 881) @@ -15,7 +15,7 @@ SQLObject has wiki at http://wiki.sqlobject.org 8-Mar-2004: SQLObject `0.5.2`_ is released (significant bugfixes). - SQLObject is now in a `Subversion repository`_. + SQLObject is now in a `Subversion repository <repository.html>`_. 12-Nov-2003: SQLObject 0.5.1 is released (minor bugfixes) 1-Nov-2003: |
From: <sub...@co...> - 2005-08-02 04:08:28
|
Author: ianb Date: 2005-08-02 04:08:19 +0000 (Tue, 02 Aug 2005) New Revision: 880 Modified: trunk/SQLObject/sqlobject/dbconnection.py Log: Made the print conditional Modified: trunk/SQLObject/sqlobject/dbconnection.py =================================================================== --- trunk/SQLObject/sqlobject/dbconnection.py 2005-08-01 15:38:47 UTC (rev 879) +++ trunk/SQLObject/sqlobject/dbconnection.py 2005-08-02 04:08:19 UTC (rev 880) @@ -290,7 +290,8 @@ print '%(n)2i%(threadName)s/%(name)s%(spaces)s%(sep)s %(s)s' % locals() def _executeRetry(self, conn, cursor, query): - print query + if self.debug: + self.printDebug(conn, query, 'QueryR') return cursor.execute(query) def _query(self, conn, s): |
From: <sub...@co...> - 2005-08-01 15:38:54
|
Author: test Date: 2005-08-01 15:38:47 +0000 (Mon, 01 Aug 2005) New Revision: 879 Modified: trunk/SQLObject/docs/web/links.txt trunk/SQLObject/docs/web/repository.txt Log: Fixed link; added a couple apps to links page Modified: trunk/SQLObject/docs/web/links.txt =================================================================== --- trunk/SQLObject/docs/web/links.txt 2005-08-01 07:38:06 UTC (rev 878) +++ trunk/SQLObject/docs/web/links.txt 2005-08-01 15:38:47 UTC (rev 879) @@ -21,6 +21,14 @@ * `Teeny Tiny CMS <http://footils.org/cms/show/3>`_. +* `rdflib <http://rdflib.net/>`_ contains a `SQLObject backend + <http://svn.rdflib.net/trunk/rdflib/backends/_sqlobject.py>_. + +* Enfold Systems' `EnTransit + <http://www.enfoldsystems.com/About/Talks/entransit-tutorial.pdf>`_ + utilizes SQLObject and rdflib for storing transactional content + from Zope. + Articles and Documentation -------------------------- Modified: trunk/SQLObject/docs/web/repository.txt =================================================================== --- trunk/SQLObject/docs/web/repository.txt 2005-08-01 07:38:06 UTC (rev 878) +++ trunk/SQLObject/docs/web/repository.txt 2005-08-01 15:38:47 UTC (rev 879) @@ -7,7 +7,7 @@ If you are using a command-line Subversion client, you can check it out like:: - svn co http://svn.pythonpaste.org/trunk/SQLObject + svn co http://svn.colorstudy.com/trunk/SQLObject If you are on Windows you may want to use `TortoiseSVN <http://tortoisesvn.tigris.org/>`_. |