modmans2ndcoming, el lunes 17 de octubre a las 15:22 me escribiste:
> 
> Does SQLObject allow you to relate different tables and have Primary
> Keys made of multiple columns?

Yes, just create an index using the multiple columns. Your real primary
key would be the id, but why do you care? Just think the id as a memory
address wich make your object's identity unique, but have no meaning to
you. You can play with get methods of SQLObject to get object based on
your needs. I've done a very simple (and maybe ugly) class to simplify
this (for SQLObject 0.6, maybe 0.7 allready comes with something similar):

class BaseSQLObject(SQLObject):

    @classmethod
    def by(cls, **kw):
        try:
            return cls.selectBy(**kw)[0]
        except IndexError:
            raise SQLObjectNotFound, "The object %s with columns %s does not 
exist" % (cls.__name__, kw)

So I inherit my SQLObects from BaseSQLObject and just write:
object = MySQLObject.by(lastname='Toto', surname='Pepe', age=25)

-- 
 LUCA - Leandro Lucarella - JID: luca(en)lugmen.org.ar - Debian GNU/Linux
.------------------------------------------------------------------------,
 \  GPG: 5F5A8D05 // F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05 /
  '--------------------------------------------------------------------'
<Damian_Des> Me anDa MaL eL CaPSLoCK

Reply via email to