edx/XBlock — pull request #167 by jorr-at-google (2014-01-17 20:45:07+00:00)
Title: Put the plugin cache at the module level

Put the plugin cache at the module level and add test for correct operation.

The motivation for this change is that the current behavior of the plugin cache is confusing, subtle and may not perform as intended. Example:

Before the very first call to load_class
Plugin._plugin_cache == None
XBlock._plugin_cache undefined

Then a call is made to XBlock.load_class('my_block'). In load_class, cls is XBlock and so:
Plugin._plugin_cache == None
XBlock._plugin_cache == { .. cached plugin .. }

Also, potentially a call could be made from somewhere to MyXBlock.load_class('my_block'). At that point we have:
Plugin._plugin_cache == None
XBlock._plugin_cache == { .. cached plugin 1 .. }
MyXBlock._plugin_cache == { .. cached plugin 2 .. }

As a result of this change, there will be a single plugin cache which holds all the cached plugins, and belongs to xblock.plugin.