def POST(self): key = xutils.get_argument("key") value = xutils.get_argument("value") type = xutils.get_argument("type") xutils.info("UpdateConfig", "%s,%s,%s" % (type, key, value)) if key == "BASE_TEMPLATE": xmanager.reload() if key in ("FS_HIDE_FILES", "DEBUG_HTML_BOX", "RECORD_LOCATION"): value = value.lower() in ("true", "yes", "on") if key == "DEBUG": setattr(xconfig, key, value == "True") web.config.debug = xconfig.DEBUG if key in ("RECENT_SEARCH_LIMIT", "RECENT_SIZE", "PAGE_SIZE", "TRASH_EXPIRE"): value = int(value) if key == "LANG": web.setcookie("lang", value) if type == "int": value = int(value) if type == "bool": value = value.lower() in ("true", "yes", "on") setattr(xconfig, key, value) cacheutil.hset('sys.config', key, value) return dict(code="success")
def POST(self): key = xutils.get_argument("key") value = xutils.get_argument("value") if key == "BASE_TEMPLATE": xmanager.reload() if key in ("FS_HIDE_FILES", "DEBUG_HTML_BOX"): value = value.lower() in ("true", "yes", "on") if key == "DEBUG": setattr(xconfig, key, value == "True") web.config.debug = xconfig.DEBUG if key in ("RECENT_SEARCH_LIMIT", "RECENT_SIZE", "PAGE_SIZE"): value = int(value) if key == "LANG": web.setcookie("lang", value) setattr(xconfig, key, value) cacheutil.hset('sys.config', key, value) return dict(code="success")
def set_sys_config(key, value): setattr(xconfig, key, value) cacheutil.hset('sys.config', key, value)