hellochar/the_game_bazaar — pull request #40 by flawedmatrix (2013-04-14 21:47:00+00:00)
Title: Improve rest api

Tons of changes were made to the website interface:

- Changed all (I hope) instances of urls to use reverse() for looking up the API

- Accessing the list of games is now GET /game/
- Accessing a game with id #gameid is now GET /game/#gameid
- Accessing a map with id #mapid is now GET /map/#mapid
- Saving a map to #mapid is now POST /map/#mapid
- Saving a new map without a mapid is now POST /map/

- gamens.py is now sockets.py (if gevent-socketio gets updated, this will be compatible with the future version)

- game.views and map.views now contain class-based views, which makes it easier to separate GET and POST requests and handle edge cases
- Moved Game controller methods to models.py, which makes them easier to test

- Removed all of the login_required decorators, since it was very repetitive
- Added LoginRequiredMiddleware, which basically puts login_required on every request except the ones specified in settings.LOGIN_EXEMPT_URLS (which can handle regexps) and settings.LOGIN_URL

- Changed the jasmine tests to use the new api (although the tests correctly use the api, it is unable to access the website because the new login required middleware redirects it back to the homepage)

- TODO:
Write more tests for the views