also, I know that it's not possible under "pure" OO programming, but I wondered if it's dirty to do it like that ?
Julien Cigar wrote: > Another quick question, relative to multiple inheritance. > Is it common to keep a back reference to the parent class within the > child class ? > > The idea behind this is that I want to be able to retrieve the child > from the parent. > > For example I have something like: > assign_mapper(session.context, content.Content, t_contents, > properties=dict(state = relation(state.State))) > > assign_mapper(session.context, folder.Folder, t_folders, > inherits=content.Content.mapper, > properties = dict(data = > relation(content.Content, secondary=t_nodes, lazy=False))) > > assign_mapper(session.context, page.Page, t_pages, > inherits=content.Content.mapper, > > properties=dict(content=relation(content.Content, backref='page'))) > > container = Folder.get(folder_id) # I get a Folder object > for data in container.data: > # Here I have Content objects > # and I want to be able to see if the Content is a Page or a News or ... > if data.page: ... > elif data.news: ... > ... > > the other idea is to add a string like "page" or "news" in the Content > table (or another table) .. > what do you think is the best solution ? > > Thanks, > Julien > > Julien wrote: > >> OK it was that ! >> >> Thanks >> >> On Mon, 2007-04-02 at 12:19 -0400, Michael Bayer wrote: >> >> >>> defintiely do not call flush() on "root_folder", call it for the >>> session overall. thats probably the issue, since its failing to get >>> the full set of child objects properly in the flush. >>> >>> On Apr 2, 2007, at 10:44 AM, Julien Cigar wrote: >>> >>> >>> >>>> Hello, >>>> >>>> I'm playing a bit with Multiple Table Inheritance (the Non-polymorphic >>>> way) and I got a problem which I have copy/paste on >>>> http://rafb.net/p/HAhx8p22.html >>>> >>>> Here is the basic idea of what I want to do (it's a kind of CMS): >>>> >>>> - "Content" is the base class for all contents (Pages, News, Events, >>>> Folder, ...) >>>> - "Folder" is a "Content" which can contain one or more "Content" >>>> (Node-like structure) >>>> >>>> I suspect that the problem is that I don't have a sequence for my >>>> primary keys in my subclasses .. ? >>>> >>>> Thanks, >>>> Julien >>>> >>>> -- >>>> Julien Cigar >>>> Belgian Biodiversity Platform >>>> http://www.biodiversity.be >>>> Universit� Libre de Bruxelles (ULB) >>>> Campus de la Plaine CP 257 >>>> B�timent NO, Bureau 4 N4 115C (Niveau 4) >>>> Boulevard du Triomphe, entr�e ULB 2 >>>> B-1050 Bruxelles >>>> office: [EMAIL PROTECTED] >>>> home: [EMAIL PROTECTED] >>>> biobel reference: http://biobel.biodiversity.be/biobel/person/show/471 >>>> >>>> >>>> >>>> >>>>> >>>>> > > > -- Julien Cigar Belgian Biodiversity Platform http://www.biodiversity.be Université Libre de Bruxelles (ULB) Campus de la Plaine CP 257 Bâtiment NO, Bureau 4 N4 115C (Niveau 4) Boulevard du Triomphe, entrée ULB 2 B-1050 Bruxelles office: [EMAIL PROTECTED] home: [EMAIL PROTECTED] biobel reference: http://biobel.biodiversity.be/biobel/person/show/471 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---