Esempio n. 1
0
def displayTemplate(tpl):
	"""Simple way how to deliver parsed template to user
		Input: (Cheetah.Template) template object
		Output: none
	"""
	if not hasTemplating:
		return
	try:
		web.output(tpl)
	except:
		webError('Error parsing template: %s' % tpl.__module__)
Esempio n. 2
0
def webError(msg):
	"""Simple way how to display error message (and exception info) to user.
		Input: none
		Output: none
	"""
	if not debugOn:
		# don't show anything other than error to user
		web.rmHeaders()
		web.rmOutput()
	
	# print error message to user
	web.internalError()
	# print error message to web interface
	if debugOn:
		web.output("<pre>\n")
		web.output(strException())
		web.output(msg)
		web.output('</pre>\n')
	
	# print error and exception info for admin
	printException()	
	error(msg)
Esempio n. 3
0
def pfPrint(msg):
	"""Print preformatted html text. Usable mostly for debugging 
		and testing purposes
	"""
	web.output('<pre>\n%s\n</pre>\n' % msg)