

def load(self):
    'Load the form.'
    domain_method = self.siteconfig.get('site_domain_method')
    site = Site.objects.get_current()
    super(GeneralSettingsForm, self).load()
    cache_backend_info = self.siteconfig.get('cache_backend')
    cache_backend = (normalize_cache_backend(cache_backend_info, DEFAULT_FORWARD_CACHE_ALIAS) or normalize_cache_backend(cache_backend_info))
    cache_type = self.CACHE_TYPES_MAP.get(cache_backend['BACKEND'], 'custom')
    self.fields['cache_type'].initial = cache_type
    if settings.DEBUG:
        self.fields['cache_type'].choices += (('locmem', _('Local memory cache')),)
    if (cache_type == 'custom'):
        self.fields['cache_type'].choices += (('custom', _('Custom')),)
        cache_locations = []
    elif (cache_type != 'locmem'):
        cache_locations = cache_backend['LOCATION']
        if (not isinstance(cache_locations, list)):
            cache_locations = [cache_locations]
        location_field = self.CACHE_LOCATION_FIELD_MAP[cache_type]
        self.fields[location_field].initial = ';'.join(cache_locations)
    self.fields['server'].initial = ('%s://%s' % (domain_method, site.domain))

dataset/ETHPy150Open reviewboard/reviewboard/reviewboard/admin/forms.py GeneralSettingsForm.load/original