Fix file naming when uploading tree photos through the API

The previous version of the add tree photo API assumed the image was a PNG and
saved the file with a .png extension. This update uses the Content-Type header
to set the file extension.
Merge pull request #28 from jwalgran/topic/tree-photo-api-ext

Fix file naming when uploading tree photos through the API
Update itree import script

Make the itree import script a bit more user friendly
by adding the following:

If you are using the standard naming (for example:
AQ_Ozone_dep.csv you can omit the column name)

If you are loading the standard set of csvs you
simply provide the absolute path to the directory
containing the csv to process all the recognized
files
Merge pull request #29 from ahinz/topic/fixscripts

Fix import scripts
Fix tearDown function indent in API tests

This function was not being run because it was not in the scope
of the TestCase subclass.
Fix typo in Version test case
Update API to bidirectionally convert choice values

Greenprint requested that the number of tree condition values be
reduced. Because the iOS application has the choice options embedded
in a config file, the API must be able to bidirectionally convert 'old'
choices to 'new' choices.

This commit accomplishes this by:

1) Defining a schema for settings.CHOICE_CONVERSIONS where forward and
reverse choice conversions can be defined and triggered by mobile platform
and version. Example:

    CHOICE_CONVERSIONS = {
        'condition': {
            'version-threshold': {
                'ios': '1.2'
            },
            'forward': [
                ("1", "8"),
                ("2", "8"),
                ("3", "9"),
                ("4", "9"),
                ("5", "10"),
                ("6", "11"),
                ("7", "11")
            ],
            'reverse': [
                ("8", "1"),
                ("9", "3"),
                ("10", "5"),
                ("11", "7"),
            ]
        }
    }

2) Adding a helper method to parse version information from the
ApplicationVersion header sent with the API requests.

3) Modifying the API calls that accept and return plot/tree JSON to convert
choice values using the mapping defined in the CHOICE_CONVERSIONS setting
_only_ if the app version is below the specified threshold.

TODO: The pending values in the API responses are not yet being converted.
Add support for updating pending choice values

I extended the support for converting old choice values passed
in to the API to cover pending edits. To prevent duplicating
logic and to reduce indentation I refactored the
convert_plot_dict_choice_values function.
Merge branch 'topic/convert-choices' of git://github.com/jwalgran/OpenTreeMap into jwalgran-topic/convert-choices
Fix failures when settings.CHOICE_CONVERSIONS is not defined

The CHOICE_CONVERSIONS setting is completely optional but there were places
in the API code that expected the setting to exist.
Merge branch 'topic/convert-choices' of git://github.com/jwalgran/OpenTreeMap into jwalgran-topic/convert-choices
Fix failing test by force reloading form field choices

The choice field options in treemap.TreeAddForm are defined when the
form module is loaded and never again. When the unit test changes the CHOICES
setting, the change was not being reflected in the form.

I attempted to reload the entire treemap.forms module, but this
caused an exception to be thrown when the __init__ method of TreeAddForm
calls the super class __init__. My solution, instead, was to
force update the options in the form field.
Update api to correctly handle non-decimal version headers

The choice conversion logic raising exceptions when the client passed
an ApplicationVersion header with a non-numeric version number, including
'1.2.3' which is a valid version number. I replaced Decimal parsing with
StrictVersion from distutils and added a check that assumes that if
the version string is not parsable, that the app making the API request
is an old version.
Merge pull request #43 from jwalgran/topic/convert-choices

Update api to correctly handle non-decimal version headers
Fixing api test suite. Setup reputations for users.
Merge pull request #57 from steventlamb/bug/fix_api_tests

Fixing api test suite. Setup reputations for users.
Adding API endpoint for generating CQL strings.
Merge pull request #59 from steventlamb/topic/add_cql_filter

Adding API endpoint for generating CQL strings.