title: Flask-Sijax callbacks are "working outside of request context"
body: <p>While inside a callback function, I lose the ability to access flask.session, flask.g, or functions such as url_for(). They all throw an error saying that I'm "working outside of request context".</p>
  
  <pre><code>Debugging middleware caught exception in streamed response at a point where response headers were already sent.
  Traceback (most recent call last):
    File "C:\Python27\site-packages\sijax\response\streaming.py", line 136, in _process_call_chain
      for string in generator:
    File "C:\Python27\site-packages\sijax\response\streaming.py", line 109, in _process_callback
      response = self._perform_handler_call(callback, args)
    File "C:\Python27\site-packages\sijax\response\base.py", line 258, in _perform_handler_call
      return callback(self, *args)
    File "C:\Dropbox\Code\Python 2.7\FlaskTesting\testpage.py", line 18, in myformhandler
      sql_session = flask.g.sql_session
    File "C:\Python27\lib\site-packages\werkzeug\local.py", line 336, in __getattr__
      return getattr(self._get_current_object(), name)
    File "C:\Python27\lib\site-packages\werkzeug\local.py", line 295, in _get_current_object
      return self.__local()
    File "C:\Python27\lib\site-packages\flask\globals.py", line 19, in _lookup_object
      raise RuntimeError('working outside of request context')
  RuntimeError: working outside of request context
  192.168.1.141 - - [20/Jun/2012 16:33:04] "POST /testpage HTTP/1.1" 200 -
  </code></pre>
  
  <p>I've been unable to find out how to get around this problem. Any help would be appreciated.</p>
  
  <ul>
  <li>Python v2.7</li>
  <li>Flask v0.8</li>
  <li>Flask-Sijax v0.3</li>
  </ul>