*model:*

def tracked(fn):
 
    def wrapped(*args, **kwargs):
 
        response.cookies['TRACKED'] = request.args[0]
        logger.debug('TRACKED = ' + str(request.args[0])) # This WILL log
 
        return fn(*args, **kwargs)
 
    return wrapped


*controller:*

@tracked
def test_cookies():
 
    return str(request.cookies)









On Wednesday, August 8, 2012 6:13:34 PM UTC-4, Anthony wrote:
>
> Probably need to see some code...
>
> On Wednesday, August 8, 2012 6:07:08 PM UTC-4, Yarin wrote:
>>
>> Guys, this problem has evolved- the issue is not models per-se- I was 
>> able to set cookies in my models in a test app, and I was able to set them 
>> in a decorator as well. I'm even able to get the cookies to write when I 
>> call the specific decorator in question from a test function. All these 
>> things work, yet when i run my application through the normal paces, the 
>> cookies won't get set in that same decorator. I'm absolutely at wits end- 
>> how could that happen? 
>>
>> Rocha- You mentioned lazy cookie creation, etc- can you please explain 
>> further?
>>
>> On Wednesday, August 8, 2012 5:24:24 PM UTC-4, rochacbruno wrote:
>>>
>>> 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
>>>
>>

-- 



Reply via email to