[Seaside] How can I access the authenticated user of a request?
Avi Bryant
avi at beta4.com
Wed Oct 29 12:07:15 CET 2003
Ian Prince wrote:
> Do you have a code example of how I might refer to the request, say to
> display the User-Agent?
>
> I must be missing something really obvious as I still can't see how I
> can reference the request in my code. In Zope/DTML this is trivial -
> just write <dtml-var REQUEST>.
No, you're not missing anything obvious. As I said earlier, there isn't
currently any easy way. Here's one thing you could do, though:
WAControllerSession subclass: #MySession
instanceVariableNames: 'request'
....
MySession>>handleRequest: aRequest
request := aRequest.
^ super handleRequest: aRequest
MySession>>request
^ request
SomeComponent>>someMethod
... (self session request headerAt: 'User-Agent') ....
If it seemed like people were doing this a lot (storing the current
request in the session and accessing it from components), then I would
push that feature up to WASession. It's just that I've never really
found a need for it, myself.
Avi
More information about the Seaside
mailing list