Write cookies from within XBlock

Hi all,
I’m writing a custom XBlock and I need to write some security related cookies.
Is there a way to access the response object or any API / interface to set cookie values in the response?

Juan Arias

As far as I know, you cannot set a cookie on an XBlock view (like student_view) since they return Fragments, but you can on an XBlock handler, since XBlock handlers like return a webob Response (see this example), and you can call set_cookie on the webob response.