Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Yielding content doesn't send cookies responses #16

Closed
manatlan opened this issue Nov 9, 2009 · 4 comments
Closed

Yielding content doesn't send cookies responses #16

manatlan opened this issue Nov 9, 2009 · 4 comments
Labels
Bug This issue is an actual confirmed bug that needs fixing Feature This is a feature request, not a bug. Open for discussion.

Comments

@manatlan
Copy link

manatlan commented Nov 9, 2009

If you do something like that :

@route('/')
def index():
    bottle.response.COOKIES['gato'] = 'hello'
    yield "hello"

cookie is not created ... the workaround is to use return instead of yield ;-(
it would be better if cookies can be created in all cases

@defnull
Copy link
Member

defnull commented Nov 9, 2009

Oh, thats right and not that easy to solve. The framework must invoke the start_response() callable before the app yields its first body string. Basically you have to define all the headers and yield None before you yield the first string. I'll try to implement this for the next release. Thank you for the hint.

@manatlan
Copy link
Author

manatlan commented Nov 9, 2009

thanks to you for your work

@sgala
Copy link
Contributor

sgala commented Feb 26, 2010

Something along the lines of this http://github.com/sgala/bottle/commit/eb221529793b9f0378e1ae3abe4a57291c3da1bb might work

The idea is to call at least once the iterable, and then call start_response and yield it before keeping yielding...

@defnull
Copy link
Member

defnull commented Mar 1, 2010

This is resolved now. You still have to add headers before yielding the first string.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This issue is an actual confirmed bug that needs fixing Feature This is a feature request, not a bug. Open for discussion.
Projects
None yet
Development

No branches or pull requests

3 participants