mozilla-services/cornice — pull request #197 by dairiki (2013-11-03 19:36:44+00:00)
Title: Bug: Schema is only being bound to the first request

Due to the schema attributes being incorrectly cached in `CorniceSchema._attributes`, the schema
for any view is only being bound to the request for the first request handled. No schema binding
occurs for subsequent requests.

In fixing this bug, I stumbled across another, namely that he `deepcopy(args)` in `register_service_view` does not play nicely with many schemas. Compiled regular expressions — as used by the `colander.Regex` validator — are, it turns out, non-pickleable. `Copy.deepcopy` can not copy non-pickleable objects.

So here are two patches. The first avoids deepcopying some parameters which I'm pretty sure don't need to be
deepcopied. The second (which depends on the first) makes sure to bind the schema on every request.

Each patch includes a test which exercises the problem fixed.