How would I know? When does the thread change?  initialize() is called on 
page load, parse_command() is called via Ajax form submission on that page. 
If it's different threads, how do I do this? Lol.

On Thursday, March 12, 2015 at 5:17:22 PM UTC-4, Niphlod wrote:
>
> are you staying in the same thread while calling BOTH initialize and 
> parse_command() ?
>
> On Thursday, March 12, 2015 at 7:46:16 PM UTC+1, Gray Kanarek wrote:
>>
>> I'm defining a variable in one of my modules:
>>
>> from gluon import *
>>
>>
>> def initialize():
>>     current.output_buffer = deque(maxlen=100)
>>
>>
>> The problem is, when I try to access the same variable in a different 
>> routine in the same module, I get:
>>
>> def parse_command(command):
>>     pre_buffer = current.output_buffer
>>
>> --------------
>>
>> AttributeError: 'thread._local' object has no attribute 'output_buffer'
>>
>> I thought that as long as I dealt with current.stored_variable in local 
>> scope, I was fine... is this not the case? Is there a better way to store a 
>> session-specific global variable than this? (I'm pretty new when it comes 
>> to web dev, so it's likely there's something I'm missing.)
>>
>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to