Exemple #1
0
def serialize(env):
	env.output["format"]="text/html"
	html=tree2xml(env.generations["layout"])
	del env.generations["layout"]
	#del env.output["html"]
	html=html.replace("</head>","<script>var appData="+json_compat.dumps(env.generations,default=default)+"</script></head>")
	return """<!DOCTYPE html>\n%s\n"""%(html)
Exemple #2
0
def serialize(env):
	xml=tree2xml(env.generations)
	xslt=""
	if env.output["XSLTFile"]:
		xslt="""<?xml-stylesheet type="text/xsl" href="http://%s/xslt/%s"?>\n"""%(env.domain,env.output["XSLTFile"])
	#TODO allow one-object output
	return """<?xml version="1.0" encoding="UTF-8"?>\n%s%s\n"""%(xslt,xml)
Exemple #3
0
 def parseAction(self, config):
     cmd = config.get("command")
     if cmd in EXEC_CMD:
         return {"expr": makeTree("".join(config["content"]).strip()), "command": "exec"}
     s = []
     for elem in config["content"]:
         if type(elem) is tuple:
             html = config["view"].output.get("format", "") == "html5"
             s.append(tree2xml(elem, not html, html=html))
         elif type(elem) is str:
             s.append(elem)
     return {"string": prepareVars("".join(s).strip()), "output": config.get("output", None)}
Exemple #4
0
	def parseAction(self,config):
		ret=config["params"].copy()
		ret["command"]=config["command"]
		if ret.has_key("input") and ret["input"]=="json":
			ret["content"]=json.loads("".join(config["content"]))
		else:
			r=[]
			for i in config["content"]:
				if type(i) is not str:
					r.append(tree2xml(i))
			ret["content"]="".join(r)
		return ret
Exemple #5
0
def serialize(env):
	env.output["format"]="text/html"
	try:
		html=tree2xml(env.generations["layout"])
		del env.generations["layout"]
	except:
		html="<html><head></head><body></body></html>"
	#del env.output["html"]
	try:
		html=html.replace("</head>","<script>var appData="+json_compat.dumps(env.generations,default=default)+"</script></head>")
	except:
		pass
	return """<!DOCTYPE html>\n%s\n"""%(html)
Exemple #6
0
	def parseAction(self, conf):
		if conf["command"] not in ("list", "create", "update", "append", "delete", "copy", "move", "exists", "get"):
			raise Error("Command '%s' do not exist!", config["command"])
		ret={
			"command":conf["command"]
		}
		if conf["content"]:
			s=[]
			for elem in conf["content"]:
				if type(elem) is tuple:
					s.append(tree2xml(elem))
				elif type(elem) is str:
					s.append(elem)
			ret["content"]=prepareVars("\n".join(s))
		ret["params"]=conf["params"]
		return ret