I have what sounds like a strange request, even to me: I'd like to create a SQLObject class on the fly. Imagine something like the following:

def create_link_table( class1, class2 ):
    class LinkTable(SQLObject):
        class sqlmeta:
            table= "link_%s_%s" % (class1, class2)
            id= None
        obj1= ForeignKey( class1 )
        obj2= ForeignKey( class2 )

    LinkTable.createTable( True )
    return LinkTable

But I don't think this will work because of SQLObject's lame registry thing. I suppose I could put each generated class into its own registry, but that's even lamer.

Any thoughts?
        
--
Jeff Watkins
http://newburyportion.com/

“In science it often happens that scientists say, ‘You know that’s a really good argument; my position is mistaken,’ and then they actually change their minds and you never hear that old view from them again. They really do it. It doesn’t happen as often as it should, because scientists are human and change is sometimes painful. But it happens every day. I cannot recall the last time something like that happened in politics or religion.” Carl Sagan, 1987

Reply via email to