PEP-8 fixes for contents APIs.

library_contents.py and history_contents.py.
Improved? (at least different) handling of library folder ids.

Move duplicated __decode_library_content_id between API controllers into UsesLibraryMixinItems._decode_library_content_id. Allow get_library_folder to take in F<id> or <id>.
Move history contents filtering logic into model.

Filtering for deleted, visible, and ids with ORM should prevent loading unneeded objects into memory (a history with 1000 items and 5 visible will now only cause 5 items to be loaded instead of 1000 just to filter out 5). Simplifies history_contents API logic somewhat, allows easier 'unit' testing (included), and provides a clearer entry point for additional 'showing' additional contents types (read dataset collections).
Rework history.contents_iter to potentially support multiple types.
Rework history_contents API to allow room for multiple 'type's of history contents.

Only poorly named 'file' (default) is currently implemented, will use new flexibility to add 'collection' type. Room made in create, show, and index methods.
Dataset Collctions - model layer.

Mapping, model definition, database migration, and model unit tests to support database collections.
WIP: Dataset collection infrastructure glue - API and service layer.
casperjs: Fix user login, registration, logout for recent masthead changes...

They are generated in javascript instead of HTML now so I don't think they are available when page loads. My fix is to wait for the User menu to appear before attempting these operations.
casperjs: Centralize logic for test user login.
casperjs: Helper method for creating API datasets.
WIP: API functional tests for dataset collections.