abztrakt/spotseeker_server — pull request #24 by sbutler (2013-04-11 19:21:38+00:00)
Title: UIUC Changes, Take #2

Changes to the server project:

- Add an external_id to the Spot model to facilitate syncing with an external database. This is meant to hold the ID for that spot in the external system. The only URL that changed was for /api/v1/spot/(id) to add "external:id"
- Add hooks for additional search filtering to views/search.py, with the associated org_filters module to hold them. This allows us to modify the DB query and/or the resultant Spot set to filter based on our own criteria.
- Move some UW spot type code into a org_filters/uw_search.py module.
- Allow an open_anytime search parameter in order to ignore the available hours, if requested.
- Simplify and unifies the various model form/validation strategies.
- Added code to more thoroughly validate inputs and return error messages. Almost all the test cases pass, with two exceptions:
- The check that UWSpotForm must have extended info is now wrong. The form no longer throws the exception, rather the REST method does.
- I've added a unique constraint for extended info fields on (spot, key). Almost nowhere in the code did I see attempts to handle multiple keys with the same name, and it doesn't seem like a useful feature as is. The test case that adds multiple keys with the same name fails.
- I've changed a lot of the code that dynamically loads modules to load only on app loading, not at every request for the dynamic module. This means some test cases needed a little more work with mock. In particular, these settings are no longer modifiable after app load:
- SPOTSEEKER_AUTH_MODULE
- SPOTSEEKER_SPOT_FORM
- SPOTSEEKER_SPOTEXTENDEDINFO_FORM
- Committed some stuff to avoid things like: url = "{0}/foo/{1}".format(...). Uses reverse instead.
- Also adds a JSONResponse object that subclasses HttpResponse. Removes a lot of boilerplate JSON serialization code.

This is the same as the previous pull request, but with some licensing fixes to put things under the Apache License.