Check REQUEST_CONTEXT.context exists before accessing it.

LMS-11226
looks like it should be okay according to this: http://stackoverflow.com/questions/6268278/modifying-global-variables-in-python-unittest-framework. But I'd like an explanation for why that's so