def error(message,**kwargs): if not isinstance(message, unicode): message = safeunicode(message) if EVENT_ERROR in dispatch.dispatch.callbacks: dispatch.pub(EVENT_ERROR,message,**kwargs) else: __default_logger_.error(message)
def info(message,**kwargs): if not isinstance(message, unicode): message = safeunicode(message) if EVENT_INFO in dispatch.dispatch.callbacks: dispatch.pub(EVENT_INFO,message,**kwargs) else: __default_logger_.info(message)
def debug(message,**kwargs): if not isinstance(message, unicode): message = safeunicode(message) if EVENT_DEBUG in dispatch.dispatch.callbacks: dispatch.pub(EVENT_DEBUG,message,**kwargs) else: __default_logger_.debug(message)
def info(message, **kwargs): if not isinstance(message, unicode): message = safeunicode(message) if EVENT_INFO in dispatch.dispatch.callbacks: dispatch.pub(EVENT_INFO, message, **kwargs) else: __default_logger_.info(message)
def error(message, **kwargs): if not isinstance(message, unicode): message = safeunicode(message) if EVENT_ERROR in dispatch.dispatch.callbacks: dispatch.pub(EVENT_ERROR, message, **kwargs) else: __default_logger_.error(message)
def debug(message, **kwargs): if not isinstance(message, unicode): message = safeunicode(message) if EVENT_DEBUG in dispatch.dispatch.callbacks: dispatch.pub(EVENT_DEBUG, message, **kwargs) else: __default_logger_.debug(message)
def post(self): self.settings.config['syslog']['enable'] = int(self.get_argument("enable")) self.settings.config['syslog']['server'] = self.get_argument("server") self.settings.config['syslog']['port'] = int(self.get_argument("port",514)) self.settings.config['syslog']['level'] = self.get_argument("level") self.settings.config.save() dispatch.pub(logger.EVENT_SETUP,self.settings.config) self.redirect("/admin/config?active=syslog")
def post(self): backup_path = self.settings.config.database.backup_path bakfs = self.get_argument("bakfs") try: os.remove(os.path.join(backup_path, bakfs)) return self.render_json(code=0, msg="delete done!") except Exception as err: dispatch.pub(logger.EVENT_EXCEPTION, err) return self.render_json(code=1, msg="delete fail! %s" % (err))
def post(self): backup_path = self.settings.config.database.backup_path backup_file = "radius_db_%s.json.gz" % utils.gen_backep_id() try: self.db_backup.dumpdb(os.path.join(backup_path, backup_file)) return self.render_json(code=0, msg="数据备份成功!") except Exception as err: dispatch.pub(logger.EVENT_EXCEPTION, err) return self.render_json(code=1, msg="数据备份失败! %s" % (err))
def post(self): try: f = self.request.files['Filedata'][0] save_path = os.path.join(self.settings.config.database.backup_path, f['filename']) tf = open(save_path, 'wb') tf.write(f['body']) tf.close() self.write("upload success") except Exception as err: dispatch.pub(logger.EVENT_EXCEPTION, err) self.write("upload fail %s" % str(err))
def post(self): backup_path = self.settings.config.database.backup_path backup_file = "radius_db_%s.before_restore.json.gz" % utils.gen_backep_id( ) rebakfs = self.get_argument("bakfs") try: self.db_backup.dumpdb(os.path.join(backup_path, backup_file)) self.db_backup.restoredb(os.path.join(backup_path, rebakfs)) return self.render_json(code=0, msg="restore done!") except Exception as err: dispatch.pub(logger.EVENT_EXCEPTION, err) return self.render_json(code=1, msg="restore fail! %s" % (err))
def post(self): active = self.get_argument("active", "syscfg") for param_name in self.get_params(): if param_name in ("active", "submit"): continue param = self.db.query(models.TrParam).filter_by(param_name=param_name).first() if not param: param = models.TrParam() param.param_name = param_name param.param_value = self.get_argument(param_name) self.db.add(param) else: param.param_value = self.get_argument(param_name) dispatch.pub(db_cache.CACHE_SET_EVENT,param.param_name,param.param_value,600) self.add_oplog(u'操作员(%s)修改参数' % (self.current_user.username)) self.db.commit() self.redirect("/admin/param?active=%s" % active)