[SQL-CVS] r4654 - SQLObject/branches/1.5/sqlobject
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <sub...@co...> - 2013-08-26 19:11:13
|
Author: phd Date: Mon Aug 26 13:11:05 2013 New Revision: 4654 Log: Minor refactoring: slightly reorder some parts of code Modified: SQLObject/branches/1.5/sqlobject/main.py Modified: SQLObject/branches/1.5/sqlobject/main.py ============================================================================== --- SQLObject/branches/1.5/sqlobject/main.py Tue Aug 20 07:30:31 2013 (r4653) +++ SQLObject/branches/1.5/sqlobject/main.py Mon Aug 26 13:11:05 2013 (r4654) @@ -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 @@ -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', 'setDeprecationLevel', 'sqlhub', 'sqlmeta', ] |