Re: Get Join instance for attribute
Oleg Broytman <[email protected]> Tue, 17 Sep 2013 23:05:34 +0400
| Newsgroups | gmane.comp.python.sqlobject |
|---|---|
| Message-ID | <[email protected]> |
Hi! On Tue, Sep 17, 2013 at 08:19:13PM +0200, [email protected] wrote: > To work with foo = RelatedJoin('Song') we use .foo, .addSong and .removeSong. But those names are configurable. How do I get them when all I know is "foo"? > > One way seems to be sqlmeta.joins[0].performJoin, .add and .remove. Is that an internal API, and subject to change? I have less and less time to work on SQLObject so until someone replaces me as the developer there will be no major changes for quite some time. > How do I get the list index? By looking up the join object you're interested in: class Test1(SQLObject): test2 = RelatedJoin('Test2') class Test2(SQLObject): test1 = RelatedJoin('Test1') for j in Test2.sqlmeta.joins: print j.joinMethodName, j.otherClassName, j.addRemoveName Oleg. -- Oleg Broytman http://phdru.name/ [email protected] Programmers don't die, they just GOSUB without RETURN. ------------------------------------------------------------------------------ LIMITED TIME SALE - Full Year of Microsoft Training For Just $49.99! 1,500+ hours of tutorials including VisualStudio 2012, Windows 8, SharePoint 2013, SQL 2012, MVC 4, more. BEST VALUE: New Multi-Library Power Pack includes Mobile, Cloud, Java, and UX Design. Lowest price ever! Ends 9/20/13. http://pubads.g.doubleclick.net/gampad/clk?id=58041151&iu=/4140/ostg.clktrk