예제 #1
0
    ],
    "omero.web.api.max_limit": [
        "API_MAX_LIMIT",
        500,
        int,
        "Maximum number of items returned from json api.",
    ],
    "omero.web.api.absolute_url": [
        "API_ABSOLUTE_URL",
        None,
        str_slash,
        ("URL to use for generating urls within API json responses. "
         "By default this is None, and we use Django's "
         "request.build_absolute_uri() to generate absolute urls "
         "based on each request. If set to a string or empty string, "
         "this will be used as prefix to relative urls."),
    ],
}

process_custom_settings(sys.modules[__name__], "API_SETTINGS_MAPPING")
report_settings(sys.modules[__name__])

# For any given release of api, we may support
# one or more versions of the api.
# E.g. /api/v0/
# TODO - need to decide how this is configured, strategy for extending etc.
API_VERSIONS = ("0", )

# Current major.minor version number
API_VERSION = "0.2"
    "omero.web.mapr.config":
        ["MAPR_CONFIG", "[]", config_list_to_dict, None],
    "omero.web.mapr.favicon":
        ["MAPR_DEFAULT_FAVICON",
         os.path.join(os.path.dirname(__file__),
                      'static', 'mapr', 'image',
                      'favicon.png').replace('\\', '/'),
         str, None],
    "omero.web.mapr.favicon_webservice":
        ["MAPR_FAVICON_WEBSERVICE",
            "http://www.google.com/s2/favicons?domain=", str, None],
    }


process_custom_settings(sys.modules[__name__], 'MAPR_SETTINGS_MAPPING')
report_settings(sys.modules[__name__])


def prefix_setting(suffix, default):
    @property
    def func(self):
        return getattr(settings, 'MAPR_%s' % suffix, default)
    return func


class MaprSettings(object):

    CONFIG = prefix_setting('CONFIG', MAPR_CONFIG)  # noqa
    DEFAULT_FAVICON = prefix_setting('DEFAULT_FAVICON',
                                     MAPR_DEFAULT_FAVICON)  # noqa
    FAVICON_WEBSERVICE = prefix_setting('FAVICON_WEBSERVICE',