Kevin Dangoor <[EMAIL PROTECTED]> writes:

> That's not SQLObject doing that, that's Python. When you do
> .some_foreign_key, a getter that SQLObject put on your class is
> retrieving the object on the other side. ".field_in_other_table" is
> just a standard attribute lookup at that point. All of that
> interpretation is being done by Python. You're not passing SQLObject
> any string to interpret here.

That's correct.  But what I was trying to point out it that it works without
requiring me to do anything neither writing getters or setters.

> So, if you pass in a string, we either need to
>
> a) recreate what Python does there, or
> b) have Python do it via eval()

What is done today with the string that is passed?  Can't it do the same with
a string with a dot in it?

> If you're just talking about getting a specific attribute from a
> single object, we can just do getattr(). But, once you start using
> "."s, you're actually into a full-blown expression.

Hmmm...  I see...  

In [14]: getattr(c, 'contrato')
Out[14]: <Contrato 2 codigo=u'1' dataAssinatura='datetime.date(200...)' 
dataVencimento='datetime.date(200...)' autoRenovar=False incluidoPorID=5 
incluidoEm='datetime.datetime...)' alteradoPorID=5 
alteradoEm='datetime.datetime...)'>

In [15]: getattr(c, 'contrato.codigo')
---------------------------------------------------------------------------
exceptions.AttributeError                            Traceback (most recent 
call last)

/home/godoy/empresa/clientes/latam/Site-Amostras/<console> 

AttributeError: 'Cliente' object has no attribute 'contrato.codigo'

In [16]: 


So, let it be...  Thanks for your time.  As I said, I can live with lambda and
now I understand what happens. ;-)

-- 
Jorge Godoy      <[EMAIL PROTECTED]>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears
-~----------~----~----~----~------~----~------~--~---

Reply via email to