@handle_response_format
@treeio_login_required
@module_admin_required()
def settings_view(request, response_format='html'):
    "Settings view"

    # default permissions
    try:
        conf = ModuleSetting.get_for_module(
            'treeio.core', 'default_permissions')[0]
        default_permissions = conf.value
    except:
        default_permissions = settings.HARDTREE_DEFAULT_PERMISSIONS

    default_permissions_display = default_permissions
    for key, value in PERMISSION_CHOICES:
        if key == default_permissions:
            default_permissions_display = _(value)

    # default perspective
    try:
        conf = ModuleSetting.get_for_module(
            'treeio.core', 'default_perspective')[0]
        default_perspective = Perspective.objects.get(pk=long(conf.value))
    except:
        default_perspective = None

    # language
    language = getattr(settings, 'HARDTREE_LANGUAGES_DEFAULT', '')
    try:
        conf = ModuleSetting.get_for_module('treeio.core', 'language')[0]
        language = conf.value
    except __HOLE__:
        pass
    all_languages = getattr(
        settings, 'HARDTREE_LANGUAGES', [('en', 'English')])

    logopath = ''
    try:
        conf = ModuleSetting.get_for_module('treeio.core', 'logopath')[0]
        logopath = conf.value
        match = re.match('.*[a-z0-9]{32}__(?P<filename>.+)$', logopath)
        if match:
            logopath = match.group('filename')
    except:
        pass

    # time zone
    default_timezone = settings.HARDTREE_SERVER_DEFAULT_TIMEZONE
    try:
        conf = ModuleSetting.get_for_module(
            'treeio.core', 'default_timezone')[0]
        default_timezone = conf.value
    except Exception:
        default_timezone = getattr(
            settings, 'HARDTREE_SERVER_TIMEZONE')[default_timezone][0]
    all_timezones = getattr(settings, 'HARDTREE_SERVER_TIMEZONE', [
                            (1, '(GMT-11:00) International Date Line West')])

    return render_to_response('core/administration/settings_view',
                              {
                                  'default_permissions': default_permissions,
                                  'default_permissions_display': default_permissions_display,
                                  'default_perspective': default_perspective,
                                  'language': language,
                                  'all_languages': all_languages,
                                  'logopath': logopath,
                                  'default_timezone': default_timezone,
                                  'all_timezones': all_timezones
                              },
                              context_instance=RequestContext(request), response_format=response_format)
dataset/ETHPy150Open treeio/treeio/treeio/core/administration/views.py/settings_view