Le dimanche 13 mai 2007 à 11:51 +0000, TiNo a écrit :
> Really strange. First of all, there is a mistake in your code. The
> method should be named _set_keywords, not set_keywords, according to
> SQLObjects docs. Without the _ it gives me:

I am not sure we are talking about the same thing...

I named this method set_keyword because I thought you wanted to call it
from your own code outside the Photo class code ... (and since _ denotes
a private method I removed it...)

It is not a mistake but done on purpose. But the problem is I think that
you did not tell us precisely what you wanted to achieve.

This _set_keyword method you are writing should be used directly by
SQLObject ? When ? Could you explain more about what you are trying to
achieve ?

In a tg-admin shell I did this:

>>> hub.begin()
>>> p = Photo(filename='yyy.jpg')
>>> p.set_keyword('k1, k2')
>>> hub.commit()

and it worked perfectly... It created a photo object and 2 keywords and
associated the keywords to the photo... hence:

>>> p.keywords
[<Keyword keyword='k1' ...>, <Keyword keyword='k2'>]

or something equivalent...

I am not sure to understand what you are trying to do apart from this.

For information I am using SQLObject-0.8.2-py2.5.egg at the moment...

Maybe you would like to define a setter property so that you could use
something like this:

>>> hub.begin()
>>> p = Photo(filename='yyy.jpg')
>>> p.keywords = 'k1, k2'

and that your _set_keyword() method is called automatically ??? Is that
what you want to do ?

Regards,
Florent Aide


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to