Re: Digging up a Session object from an EOGenericRecord
Re: Digging up a Session object from an EOGenericRecord
- Subject: Re: Digging up a Session object from an EOGenericRecord
- From: Mike Schrag <email@hidden>
- Date: Sat, 7 Mar 2009 11:34:39 -0500
You are right there. But the value is only stored for inspection.
Nothing depends on it and it's only to satisfy my client that want's
to know who wrote/modified what (it's an online newspaper). In other
words it is perfectly fine for it to be empty if I ever used it from
outside of my webapp. If it where only for the timestamp I could
rely on specific db features like MySQL's ability to auto set the
timestamp. But I need the user as well.
How does ERXThreadStorage work? What can I assume to be in the same
thread?
Whatever you put in it ... It's a ThreadLocal place to shove data, so
you can push the current user (or current user GID) into it. You
really shouldn't access the Session from model classes, it's just bad
form and eventually there's good odds you're going to regret it.
Also, putting the current user into ERXThreadStorage means that you
don't have to worry about other code making new editing contexts where
your state isn't setup. I've seen several people subclassing EC's to
add custom app state, but for me, it misrepresents what an EC's role
is, and invariably leads to weird issues (like the local instancing
into other ec's, etc).
ms
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden