コード例 #1
0
ファイル: nat.py プロジェクト: poyhsiao/lzweb
	def index(self):
		self.msg = []
		try:
			nat_jcfg = xte_nat.get()
			group_jcfg = info.getGroupJcfg()
			summary_jcfg = xte_summary.get()
			if not summary_jcfg[0]:
				summary_jcfg[1] = {};
			tmp = controller.lookup.get_template("nat.mako")
			if nat_jcfg[0]: # load successfully
				return tmp.render(nat_args = nat_jcfg[1],
					ipgroup_args = group_jcfg[0],
					servicegroup_args = group_jcfg[1],
					fqdn_args = group_jcfg[2],
					summary_args = summary_jcfg[1],
					msg_list = self.msg)
			else:
				self.addMsg(str(nat_jcfg[1]))
				return tmp.render(nat_args = {},
					ipgroup_args = group_jcfg[0],
 					servicegroup_args = group_jcfg[1],
					fqdn_args = group_jcfg[2],
					summary_args = summary_jcfg[1],
					msg_list = self.msg)
		except:
			exceptions.html_error_template().render()
コード例 #2
0
ファイル: nat.py プロジェクト: poyhsiao/lzweb
	def natHandler(self, **kwargs):
		self.msg = []
		group_jcfg = info.getGroupJcfg()
		nat_jcfg = json.loads(kwargs['NatSetting'])
		summary_jcfg = xte_summary.get()
		if not summary_jcfg[0]:
			summary_jcfg[1] = {};
		ret = xte_nat.set(nat_jcfg, str(cherrypy.request.login))
		tmp = controller.lookup.get_template("nat.mako")
		if ret[0]: # save successfully
			self.addMsg(_("Settings are applied for page Service -> NAT"))
			return tmp.render(nat_args = nat_jcfg,
				ipgroup_args = group_jcfg[0],
				servicegroup_args = group_jcfg[1],
				fqdn_args = group_jcfg[2],
				summary_args = summary_jcfg[1],
				msg_list = self.msg)
		else:
			self.addMsg(lang.change_error_msg(ret[1]))
			return tmp.render(nat_args = nat_jcfg,
				ipgroup_args = group_jcfg[0],
				servicegroup_args = group_jcfg[1],
				fqdn_args = group_jcfg[2],
				summary_args = summary_jcfg[1],
				msg_list = self.msg)
コード例 #3
0
ファイル: summary.py プロジェクト: poyhsiao/lzweb
	def summaryHandler(self, **kwargs):
		self.msg = []
		pos = kwargs['position']
		summary_jcfg = xte_summary.get()
		tmp = controller.lookup.get_template("summary.mako")

		for index in const.ALL_NICS:
			if index == pos:
				ret = xte_summary.reconnect_dynamic_wan(pos)
				if ret[0]: # reconnect successfully
					self.addMsg(_("Reconnect successfully"))
				else:
					self.addMsg(lang.change_error_msg(ret[1]))
		
		for index in const.ALL_USBS:
			if index == pos:
				ret = xte_summary.reconnect_dynamic_usb_wan(pos)
				if ret[0]: # reconnect successfully
					self.addMsg(_("Reconnect successfully"))
				else:
					self.addMsg(lang.change_error_msg(ret[1]))		
		

		if summary_jcfg[0]: # load successfully
			return tmp.render(summary_args = summary_jcfg[1], msg_list = self.msg)
		else:
			self.addMsg(str(summary_jcfg[1]))
			return tmp.render(summary_args = {}, msg_list = self.msg)
コード例 #4
0
ファイル: summary.py プロジェクト: poyhsiao/lzweb
	def index(self):
		self.msg = []
		try:
			summary_jcfg = xte_summary.get()
			tmp = controller.lookup.get_template("summary.mako")
			if summary_jcfg[0]: # load successfully
				return tmp.render(summary_args = summary_jcfg[1], msg_list = self.msg)
			else:
				self.addMsg(str(summary_jcfg[1]))
				return tmp.render(summary_args = {}, msg_list = self.msg)
			return tmp.render()
		except:
			exceptions.html_error_template().render()