if he is setting the cookie inside a decorator function (inner-function) maybe it gets defined on the start of the request.
when the decorated function gets passed to the decorator inner-function, I guess the cookie will be already setted. (but we need to take a look at the code to figure out the scope) He needs to make the cookie creation Lazy, maybe put this in a lambda or use current. It is better to share the important part of your decorator functions --

