From: Jason Kirtland Date: Tue, 13 Jan 2009 02:43:52 +0000 (+0000) Subject: - Tightened up **kw on ColumnProperty and its front-end functions. X-Git-Tag: rel_0_5_1~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=313762e86f889c45e35a5c81cef67941c517321d;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git - Tightened up **kw on ColumnProperty and its front-end functions. --- diff --git a/CHANGES b/CHANGES index bee0df276d..35c0032f27 100644 --- a/CHANGES +++ b/CHANGES @@ -37,6 +37,9 @@ CHANGES operation, greatly simplifying typical usage patterns within declarative. [ticket:1269] + - ColumnProperty (and front-end helpers such as ``deferred``) no + longer ignores unknown **keyword arguments. + - schema - Index now accepts column-oriented InstrumentedAttributes (i.e. column-based mapped class attributes) as column diff --git a/lib/sqlalchemy/orm/properties.py b/lib/sqlalchemy/orm/properties.py index 0211b9707a..a4561d443d 100644 --- a/lib/sqlalchemy/orm/properties.py +++ b/lib/sqlalchemy/orm/properties.py @@ -32,12 +32,24 @@ class ColumnProperty(StrategizedProperty): """Describes an object attribute that corresponds to a table column.""" def __init__(self, *columns, **kwargs): - """The list of `columns` describes a single object - property. If there are multiple tables joined together for the - mapper, this list represents the equivalent column as it - appears across each table. - """ + """Construct a ColumnProperty. + + :param \*columns: The list of `columns` describes a single + object property. If there are multiple tables joined + together for the mapper, this list represents the equivalent + column as it appears across each table. + + :param group: + + :param deferred: + + :param comparator_factory: + :param descriptor: + + :param extension: + + """ self.columns = [expression._labeled(c) for c in columns] self.group = kwargs.pop('group', None) self.deferred = kwargs.pop('deferred', False) @@ -45,6 +57,11 @@ class ColumnProperty(StrategizedProperty): self.comparator_factory = kwargs.pop('comparator_factory', self.__class__.Comparator) self.descriptor = kwargs.pop('descriptor', None) self.extension = kwargs.pop('extension', None) + if kwargs: + raise TypeError( + "%s received unexpected keyword argument(s): %s" % ( + self.__class__.__name__, ', '.join(sorted(kwargs.keys())))) + util.set_creation_order(self) if self.no_instrument: self.strategy_class = strategies.UninstrumentedColumnLoader @@ -1136,4 +1153,4 @@ mapper.ColumnProperty = ColumnProperty mapper.SynonymProperty = SynonymProperty mapper.ComparableProperty = ComparableProperty mapper.RelationProperty = RelationProperty -mapper.ConcreteInheritedProperty = ConcreteInheritedProperty \ No newline at end of file +mapper.ConcreteInheritedProperty = ConcreteInheritedProperty