All will respond with an HTTP status code of "200 OK". Works on .32:

def GET(self):
  return 'implicit 200'

def GET(self):
  web.ctx.status = '200 OK'
  return 'explicit 200'

def GET(self):
  raise web.OK('explicit 200')

You shouldn't be receiving an AttributeError when calling OK if you've
simply imported web.py standalone (`import web`).

If you are having a problem sending raw HTML you might find that you need to
send an explicit HTTP Content-Type header using:

web.header('Content-Type', 'text/html')

or optionally define a character set:

web.header('Content-Type', 'text/html; charset=utf-8')

When rendering a template using a `web.template.render` object the header is
automagically sent using the appropriate MIME (content) type based on the
file being rendered (.html => text/html; charset=utf-8, .xhtml =>
application/xhtml+xml; charset=utf-8, .txt => text/plain — see line 820 in
`template.py`).

Let me know if that helps.

On Thu, Nov 5, 2009 at 7:02 AM, David Montgomery
<[email protected]>wrote:

> Is there not a way to return a status code?  Given I am returning a html
> string...how to I return a status code?
>
>
>
> On Wed, Nov 4, 2009 at 11:33 AM, David Montgomery <
> [email protected]> wrote:
>
>> 3.2
>>
>>
>> On Wed, Nov 4, 2009 at 11:27 AM, Anand Chitipothu 
>> <[email protected]>wrote:
>>
>>>
>>> 2009/11/4 David Montgomery <[email protected]>:
>>> > Not working
>>> >
>>> > error: 'module' object has no attribute 'ok'
>>> >
>>> > return web.ok
>>> > return html
>>> >
>>> > So...how to I do this?
>>>
>>> What is the version of web.py that you are using?
>>>
>>>
>>>
>>
>>
>> --
>> David Montgomery
>> CEO
>> AdAloha
>> Honolulu, Hawaii 96815
>> 808-351-5046
>> http://www.AdAloha.com
>> [email protected]
>>
>>
>
>
> --
> David Montgomery
> CEO
> AdAloha
> Honolulu, Hawaii 96815
> 808-351-5046
> http://www.AdAloha.com
> [email protected]
>
>
> >
>


-- 
Angelo Gladding
[email protected]
http://angelo.gladding.name/
E69E 47E8 5C3A 96E5 C70F
D931 F35C ACBA 6F39 9611

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to