Hi, there I'm using Elixir in a new project and, during unit tests, I hit a situation that maybe a bug. Before data is flushed, an OneToMany(..., order_by='<fieldname>') relationship just appends related objects at the end of the list, ignoring the order_by clause. Only after session is committed, order_by is respected.
To illustrate the point, suppose the classes used in Elixir's tutorial (http://elixir.ematia.de/trac/wiki/ TutorialDivingIn#a4.Simplerelationships): class Movie(Entity): title = Field(Unicode(30)) year = Field(Integer) description = Field(UnicodeText) director = ManyToOne('Director') def __repr__(self): return '<Movie "%s" (%d)>' % (self.title, self.year) class Director(Entity): name = Field(Unicode(60)) movies = OneToMany('Movie', order_by='-year') # <== modified to show the bug rscott = Director(name=u"Ridley Scott") alien = Movie(title=u"Alien", year=1979, director=rscott) brunner = Movie(title=u"Blade Runner", year=1982, director=rscott) rscott.movies will show [<Movie "Alien" (1979)>, <Movie "Blade Runner" (1982)>] The expected result is obtained only after session.commit(): [<Movie "Blade Runner" (1982)>, <Movie "Alien" (1979)>] Regards, André --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "SQLElixir" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/sqlelixir?hl=en -~----------~----~----~----~------~----~------~--~---
