I'm not 100% sure about doing it using ActiveMapper as I don't
personally use it, but using straight SQLAlchemy that is possible
quite easily.

post_table = Table("posts", metadata,
    Column("id", Integer, primary_key=True),
    Column("title", String(50)),
    Column("stub", String(50))
)  # left out all the other stuff for brevity :)

class Post(object):
    def create_stub(self, title):
        #Your stub creation code here
        pass

    def _get_title(self):
        return self._title

    def _set_title(self, title):
        self._title = title
        self.stub = self.create_stub(title)

    title = property(_get_title, _set_title)

assign_mapper(session.context, Post, post_table,
    properties={
        "_title": post_table.c.title
    }
)

Hope this helps.

Lee

On 10/28/06, Robin Haswell <[EMAIL PROTECTED]> wrote:
>
> Hey guys
>
> In my model I have Post objects, which are a bit like stories on Digg.
> Each story has a "stub", which is the URL-friendly form (eg, "Hey guys!"
> => "Hey_guys"). With SQLObject I think you could do:
>
> def _set_title(self, value):
>         self._SO_set_title(value)
>         stub = self.create_stub(value)
>         self.stub = stub
>
> Is there an equivalent for SQLAlchemy? I'm using ActiveMapper, if that
> matters.
>
> Thanks
>
> -Rob
>
>
> >
>


-- 
Lee McFadden

blog: http://www.splee.co.uk
work: http://fireflisystems.com

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