On 13/04/06, Tim Lesher <[EMAIL PROTECTED]> wrote:
>
> On 4/13/06, Ed Singleton <[EMAIL PROTECTED]> wrote:
> > Well, that does sound like what I want, but I can't find any mention
> > of it in the main SQLObject documentation.
>
> It's not there.  Actually, there are a number of column attributes
> that aren't documented, and don't appear to be used at all by
> SQLObject: "title", "tags", "noCache", etc.
>
> > I don't suppose you know
> > of any usage examples or documentation for it do you?
>
> It's just a straightforward attribute on the SOCol object. If you
> supply a "title" keyword argument when defining a column, sqlobject
> will set the "title" attribute; otherwise, it defaults to None.
> SQLObject never even references it on its own, as far as I can see.
>
> As far as where it's used now in TG, ModelDesigner (from the TG
> toolbox) allows you to specify the column title when you're laying out
> your model, and FastData automatically uses the column's title when
> displaying either lists or individual objects.  Those are the only
> places I know of that use it.

Okay, I had a play with it and it's easy enough.  It caught me out a
bit as I was expecting to be able to access it as:

p1 = Person(firstname="Ed", secondname="S", email="[EMAIL PROTECTED]")
p1.email.title # would return the title string of email

However it is an attribute of the column in sqlmeta.columns.

In which case I can't see any obvious way to iterate over the titles
in sqlmeta.columns and the fields of my Person object at the same time
(unless I use getattr I suppose, but I don't like using that unless I
have to).

Is there a way to access to fields of the Person object (p1 above) in
a dictionary style?  So that I can do:

for column in Person.sqlmeta.columns.keys:
    print column.title, ": ", p1.fieldsasdict[column]

(I've had a look through the FastData source but I can't work out how
FastData does it).

Thanks

Ed

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to turbogears@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to