properties with backref has it's own attribute_ext overriden by a backref extension

Issue #927 resolved
Former user created an issue

line 662 of properties.py is self.attributeext = self.backref.get_extension()

is this desired?

or should we

self.attributeext = (self.attributeext or [+ self.backref.get_extension())

Comments (5)

  1. Mike Bayer repo owner

    uh yeah probably, but then again i think attributeext might be better as just becoming something private (remove from PropertyLoader constructor, add an underscore). I'm not really sure I want people building their own attribute extensions ( I did originally). Is there some use case you see for user-defined attribute extensions ? (which would not be more simply and API-neutrally built as class-defined properties).

    also who's this ? same person who spotted #925 ?

  2. Former user Account Deleted

    Hi, yep it's the person who posted #925. I did mention a while back on the forum that i am going to report the bugs mentioned

    I don't really have a sensible use case for attributeext, but have implemented a small aspect of something as attributeext to test it out.

    If anything, attributeext would be good for append and remove handling on collection attributes (and provide a common way to organise/register such extensions)

    Lei

  3. Mike Bayer repo owner

    Ok, append/remove is somewhat of a use case, but then again the collections framework allows you to build your own collections with whatever customized behavior you want and that's where we've put the time in documenting how to do it and such (using @appender decorators, etc).

    I still think i want to take "attributeext" out of PropertyLoader; its not in the public relation() function.

    if i did want attribute extensions to be a publically available feature, maybe it could be done like:

    from sqlalchemy.orm.attributes import attribute_extender
    class Foo(object):
       bar = attribute_extender(on_set=somesetter, on_append=onappend)
    
  4. Mike Bayer repo owner

    attributeext is no longer a public argument and we have quite a lot of ways to augment instrumentation behavior now

  5. Log in to comment