Fix segfault in django inventory model.
Fix segfault in django inventory model.

Django memoizes model classes using its metaclass.  Constructing a
nested class that referenced the django request object in the parent
scope thus resulted in that request object being immortalized in the
closure cell.  Subsequent declarations of the class were silently
replaced by the original declaration.  The observed effect is that the
second invocation of this serialize method in a particular execution
context attempted to execute methods against a mod_python request handle
to a long since dead underlying structure, thus triggering a segfault.

Ideally mod_python would be polite and throw an exception when methods
on a dead request object are invoked. This appears not to be the case.

sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint,sassoftware/mint