On Jan 9, 2008, at 1:55 PM, Mike Orr wrote:
>
> On Jan 9, 2008 1:16 PM, Kevin Baker <[EMAIL PROTECTED]> wrote:
>>
>>
>> I am on Pylons 0.9.6.1. I see that there have been changes for the
>> usage of the response object in the controller.
>>
>> I am new to Pylons and thought I'd start with Authkit implementation
>> to my current db of users. In the Cookbook example I was following it
>> uses Response directly and throws a "401" status.
>>
>> How would I do this with the current implementation?
>>
>> Current Code:
>>
>> <code python>
>> response.status = "401 Not authenticated"
>> return 'You are not Authenticated'
>> </code>
>>
>>
>> Tutorial Code:
>>
>> <code python>
>> response = Response('You are not authenticated')
>> response.status = "401 Not authenticated"
>> return res
>> </code>
>>
>>
>> I'm considering custom authentication, but want to be sure I
>> understand the response object better before moving on.
>
> Your current code is correct. The tutorial is following the older
> Pylons 0.9.5 convention, and should be updated. However, either way
> will work.
>
> By the way, the easiest way to do this is to call "abort(401)". This
> raises an HTTPNotAuthorized exception and modifies the response for
> you. I haven't looked at AuthKit closely enough to be 100% sure it's
> compatible with what they're doing, but it's emerging as the
> "standard" way to signal HTTP errors. You can include a custom
> message as the second argument if you wish.
>
Great, Thanks! I'll try that tonight.
Is there any documentation on what is going on under the hood for the
global response object in the controller? I'd like to get a better
sense of how I would:
* add header mime-type information
* use other commands like abort()
Also are other people using AuthKit or is it sort of an outdated
concept? The feature set looks great, but thinking I'd want some
abstraction to simplify it a bit for my app. If it is not the
"standard" way to go I'll write custom...
Thanks again,
- kevin
> --
> Mike Orr <[EMAIL PROTECTED]>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"pylons-discuss" 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/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---