Hi All,

How do you pass a ManyToOne property to a function ?

I have a function that selectively prints columns from a given row:

def Print(rowlist, collist):
    for r in rowlist:
         for c in collist:
              print r.__dict__[c.name]

using the following Entities:

class User(Entity):
    using_options(tablename="user")
    UserId = Field(String(16))
    Name = Field(String(64))

class History(Entity):
    using_options(tablename="history")
    Sequence = Field(Integer)
    UserId = ManyToOne("User")

called from main as follows:
....
rows = History.query.all()
cols = list()
cols.append(History.table.columns.Sequence)
cols.append(History.table.columns.UserId_id)  # ???? I need to print
User.Name
Print(rows,cols)

given the following works:
for r in rows:
    print r.Sequence, r.UserId.Name
I think passing a column property to function will also work. I just
dont know how.

Thanks in Advance,
George




--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to