I am trying to keep debug calls in list of 50 items (last 50 calls), debug is dumped when an error is thrown. The list should only maintain state for the current request. I don't want the list shared across sessions or requests.
So I am coming from an Oracle PL/SQL / VB background in which we can define a variable in a package (module) outside any procedures or functions and the variable is accessible from other modules and maintains state for session (in my case I only care about the request). I know I must be missing something pretty simple. Would appreciate any help. So far I can only seem to maintain m_stack by using "global" which is not what I want. Thanks, Ethan debug.py # First problem is I need to initilize this variable with 50 empty values. I tried "if __name__ == 'main'" and that didn't seem to work. m_stack = list(('',)*49) # So this only seems to work when I add "global m_stack" but then the data is shared across different sessions, I don't want that. def log (s): del m_stack[0] m_stack.append(s) def print_stack (): for i in m_stack: if len(i) > 0: print i m_stack = list(('',)*49) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---