OrderedProperties suffers from clashes between table columns names and its own methods

Issue #3475 resolved
Alessandro Molina created an issue

OrderedProperties provides the getattr method which allows to lookup for column information using the dot notation, the issue is that in case my column was actually called like a method of OrderedProperties it returns the method instead of the column.

This is probably not a bug, but it's an unexpected behaviour in most cases. See https://github.com/TurboGears/tg2/issues/64 for origin of this issue.

Probably dot notation access should be deprecated to avoid confusion and only allow dictionary stile access?

Comments (3)

  1. Mike Bayer repo owner
    • add a warning suggesting to use the dictionary form of access if the name of the attribute being accessed is non-specific, thereby avoiding collisions on names like items, values, keys. fixes #3475

    → <<cset 6fcc5d4a07e5>>

  2. Mike Bayer repo owner

    this is the object that does table.c.columname so deprecation would be pretty extreme. getattr() shouldn't be used with this object so a warning is added thanks for reporting!

  3. Log in to comment