[SQL-CVS] r4657 - in SQLObject/trunk: docs sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2013-08-26 19:18:07
|
Author: phd Date: Mon Aug 26 13:18:01 2013 New Revision: 4657 Log: Merged revisions 4654:4656 from branch 1.5 Minor refactoring: slightly reorder some parts of code. Remove setDeprecationLevel from the list of public functions. Support for Python 2.4 is declared obsolete. Modified: SQLObject/trunk/docs/News.txt SQLObject/trunk/sqlobject/main.py Modified: SQLObject/trunk/docs/News.txt ============================================================================== --- SQLObject/trunk/docs/News.txt Mon Aug 26 13:16:22 2013 (r4656) +++ SQLObject/trunk/docs/News.txt Mon Aug 26 13:18:01 2013 (r4657) @@ -19,11 +19,16 @@ * Helpers for class Outer were changed to lookup columns in table's declarations. +* Support for Python 2.4 is declared obsolete and will be removed + in the next release. + Minor features -------------- * Encode unicode enum values to str. +* Removed setDeprecationLevel from the list of public functions. + * A number of fixes for tests. Bugfixes Modified: SQLObject/trunk/sqlobject/main.py ============================================================================== --- SQLObject/trunk/sqlobject/main.py Mon Aug 26 13:16:22 2013 (r4656) +++ SQLObject/trunk/sqlobject/main.py Mon Aug 26 13:18:01 2013 (r4657) @@ -51,7 +51,6 @@ code-blocks to execute _after_ the whole hierachy of inherited SQLObjects is created. See SQLObject._create """ -_postponed_local = local() NoDefault = sqlbuilder.NoDefault @@ -632,22 +631,8 @@ sqlhub = dbconnection.ConnectionHub() -class _sqlmeta_attr(object): - - def __init__(self, name, deprecation_level): - self.name = name - self.deprecation_level = deprecation_level - def __get__(self, obj, type=None): - if self.deprecation_level is not None: - deprecated( - 'Use of this attribute should be replaced with ' - '.sqlmeta.%s' % self.name, level=self.deprecation_level) - return getattr((type or obj).sqlmeta, self.name) - - -# @@: This should become a public interface or documented or -# something. Turning it on gives earlier warning about things +# Turning it on gives earlier warning about things # that will be deprecated (having this off we won't flood people # with warnings right away). warnings_level = 1 @@ -663,8 +648,8 @@ if warnings_level is not None and warnings_level <= level: warnings.warn(message, DeprecationWarning, stacklevel=stacklevel) -#if sys.version_info[:3] < (2, 5, 0): -# deprecated("Support for Python 2.4 has been declared obsolete and will be removed in the next release of SQLObject") +if sys.version_info[:3] < (2, 5, 0): + deprecated("Support for Python 2.4 has been declared obsolete and will be removed in the next release of SQLObject") def setDeprecationLevel(warning=1, exception=None): """ @@ -677,12 +662,11 @@ The levels currently mean: - 1) Deprecated in current version (0.9). Will be removed in next - version (0.10) + 1) Deprecated in current version. Will be removed in next version. 2) Planned to deprecate in next version, remove later. - 3) Planned to deprecate sometime, remove sometime much later ;) + 3) Planned to deprecate sometime, remove sometime much later. As the SQLObject versions progress, the deprecation level of specific features will go down, indicating the advancing nature of @@ -698,6 +682,22 @@ exception_level = exception +class _sqlmeta_attr(object): + + def __init__(self, name, deprecation_level): + self.name = name + self.deprecation_level = deprecation_level + + def __get__(self, obj, type=None): + if self.deprecation_level is not None: + deprecated( + 'Use of this attribute should be replaced with ' + '.sqlmeta.%s' % self.name, level=self.deprecation_level) + return getattr((type or obj).sqlmeta, self.name) + + +_postponed_local = local() + # SQLObject is the superclass for all SQLObject classes, of # course. All the deeper magic is done in MetaSQLObject, and # only lesser magic is done here. All the actual work is done @@ -1742,7 +1742,7 @@ else: return obj -__all__ = ['NoDefault', 'SQLObject', 'sqlmeta', 'sqlhub', - 'getID', 'getObject', 'setDeprecationLevel', - 'SQLObjectNotFound', 'SQLObjectIntegrityError', +__all__ = ['NoDefault', 'SQLObject', + 'SQLObjectIntegrityError', 'SQLObjectNotFound', + 'getID', 'getObject', 'sqlhub', 'sqlmeta', ] |