handle creation reviewed and updated
fix file writing: check_conflict call didn't close file handle

the check_conflict call has to do different things when it
checks a folder or file.

A typical python error came in checking:
    if not file_handle
for finding out that something is a directory
(opening it as a file failed), instead of checking:
    if file_handle is not None

Incidentally, a working file_handle evaluates False ...
remove unnecessary flask.g import from irodsstorage
fix connection release if api function raises exception

the connections were not released correctly when
the function raised an exception. fix this by interception
each raise in the get_connection decorator, release the
connection, and re-raise the exception.
add more elaborate connection checking

check for more atributes of the irods connection that
can indicate an error. since I couldn't find any documentation,
the bhaviour I am checking for is guessed.
already destroy bad connections on release()
fix logic error in connection checking
add a test to test invalid byte range headers
add checks to the byte range header processing

Add two levels of checks:
1. validate the format of the whole byte range header value
    with a regular expression
2. Only set the storage.START and END constant if the
    value of a range field is ''
fix byte range behaviour; support correct -500

Support the missing start and numerical end value that means
getting n byte from the end of the file.

Rewrite the range parsing function in the cdmi.py and introduce
and new constant BACKWARDS to signal this case.

Rewrite the functions in storage that parse the constants and
convert them into offsets and move them to storage_common.py.
add debug messages for irods connection handling
adjust test for correct byte range interpretation
refactor the test structure

integration tests can now inherit from the TestApi class,
which provides the app instantiation and a open_with_auth function.
expect a 403 error instead of a 401 on wrong credentials
add integration tests for the CDMI api

for now there are only tests for GETting a file or container
and the cdmi json structures are now checked for formal correctness.

this is still enough for the tests to fail.
use the abort() call in auth to allow use of errorhandlers
fix/refactor requests functions

- make cdmi match both -object and -container
- add convenience request_wants_cdmi function
- fix line lengths
many fixes to cdmi output

- add output buffering (experimental)
- add cdmi version recognition support
- change to adjust to changed request_wants functions
- add get_config_parameter function to get CDMI params
- add function to immediately reject a non-conform cdmi request
- immediately disallow cdmi requests with multi range
- fix valuerange parameter for range request
- return 403 (not 401) if credentials are wrong
- return correct cdmi version and content_type on GET functions
- fix line lengths
- use json.dumps() to prepare values for json output wherever possible
- add missing cdmi values
- add 403 error handler
fix formatting and two comment replies
generalization of the destination url; more comments

With this commit, I was able to successfully register
a file from /tmp/ to /tmp/registered/