Hmmm.   Where can I read more about the '@property' bit - I can't seem
to find it in the Turbogears or SQLAlchemy documentation.  How would I
use this syntax to define 'set' methods?


On Jun 2, 5:03 pm, "Diez B. Roggisch" <[email protected]> wrote:
> kerinin schrieb:
>
> > I'm trying to migrate from SQLObject to SQLAlchemy / Elixir and I'm
> > running into problem implementing SQLObject's _get_ and _set_
> > functions.  Here's the code in question:
>
> > class Video(elixir.Entity):
> >    def _get_youtube_id(self):
> >            return self.uri.split('/')[-1]
> >    elixir.has_property('youtube_id',_get_youtube_id)
>
> > In SQLObject the getter works fine, but now when I try to run it with
> > Elixir I get this error:
>
> You don't use the has_property-declaration properly.
>
> It's meant to work for *SQL*-based properties, not for "normal" properties.
>
> So a simple
>
> @property
> def youtube_id(self):
>      return self.uri.split("/")[-1]
>
> will work.
>
> Diez
--~--~---------~--~----~------------~-------~--~----~
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