--------------------------------------------------------------------------------
Calling a Python function
--------------------------------------------------------------------------------
Hello World

--------------------------------------------------------------------------------
Calling a Python class
--------------------------------------------------------------------------------
Hi ASPer!
Bye ASPer, come back soon.

--------------------------------------------------------------------------------
Calling an ActiveX component
--------------------------------------------------------------------------------
Fabio Zendhi Nagao
nagaozen

--------------------------------------------------------------------------------
Calling ASP objects
--------------------------------------------------------------------------------
session_value



{ALL_HTTP:HTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_ACCEPT_ENCODING:x-gzip, gzip, deflate
HTTP_HOST:evolved.com.br
HTTP_USER_AGENT:CCBot/2.0 (http://commoncrawl.org/faq/)
HTTP_X_FORWARDED_PROTO:https
HTTP_X_FORWARDED_FOR:54.221.136.62
, ALL_RAW:Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: x-gzip, gzip, deflate
Host: evolved.com.br
User-Agent: CCBot/2.0 (http://commoncrawl.org/faq/)
X-Forwarded-Proto: https
X-Forwarded-For: 54.221.136.62
, APPL_MD_PATH:/LM/W3SVC/873784055/Root, APPL_PHYSICAL_PATH:C:\var\www\unittest.evolved.com.br\, AUTH_PASSWORD:, AUTH_TYPE:, AUTH_USER:, CERT_COOKIE:, CERT_FLAGS:, CERT_ISSUER:, CERT_KEYSIZE:, CERT_SECRETKEYSIZE:, CERT_SERIALNUMBER:, CERT_SERVER_ISSUER:, CERT_SERVER_SUBJECT:, CERT_SUBJECT:, CONTENT_LENGTH:0, CONTENT_TYPE:, GATEWAY_INTERFACE:CGI/1.1, HTTPS:off, HTTPS_KEYSIZE:, HTTPS_SECRETKEYSIZE:, HTTPS_SERVER_ISSUER:, HTTPS_SERVER_SUBJECT:, INSTANCE_ID:873784055, INSTANCE_META_PATH:/LM/W3SVC/873784055, LOCAL_ADDR:192.168.5.20, LOGON_USER:, PATH_INFO:/python.lang.asp, PATH_TRANSLATED:C:\var\www\unittest.evolved.com.br\python.lang.asp, QUERY_STRING:, REMOTE_ADDR:192.168.5.19, REMOTE_HOST:192.168.5.19, REMOTE_USER:, REQUEST_METHOD:GET, SCRIPT_NAME:/python.lang.asp, SERVER_NAME:evolved.com.br, SERVER_PORT:80, SERVER_PORT_SECURE:0, SERVER_PROTOCOL:HTTP/1.0, SERVER_SOFTWARE:Microsoft-IIS/6.0, URL:/python.lang.asp, HTTP_ACCEPT:text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8, HTTP_ACCEPT_ENCODING:x-gzip, gzip, deflate, HTTP_HOST:evolved.com.br, HTTP_USER_AGENT:CCBot/2.0 (http://commoncrawl.org/faq/), HTTP_X_FORWARDED_PROTO:https, HTTP_X_FORWARDED_FOR:54.221.136.62, }

--------------------------------------------------------------------------------
This source
--------------------------------------------------------------------------------
<%@
	language = "Python"
	codepage = 65001
	lcid     = 1033
%><pre><%

Response.charset = "UTF-8"

def read_text_file(path):
	Stream = Server.createObject("ADODB.Stream")
	Stream.Type = 2
	Stream.Mode = 3
	Stream.Charset = "UTF-8"
	Stream.Open()

	Stream.LoadFromFile(path)
	Stream.Position = 0
	txt = Stream.ReadText()

	Stream.Close()
	Stream = None

	return txt.replace('<', '<')

def hello_world():
	return "Hello World"

class Greeter:
	def __init__(self, name = "human"):
		self.name = name

	def say_hi(self):
		return "Hi %s!"%(self.name)

	def say_bye(self):
		return "Bye %s, come back soon."%(self.name)

Response.write( "--------------------------------------------------------------------------------\n" )
Response.write( "Calling a Python function\n" )
Response.write( "--------------------------------------------------------------------------------\n" )
Response.write( hello_world() + "\n" )
Response.write( "\n" )

Response.write( "--------------------------------------------------------------------------------\n" )
Response.write( "Calling a Python class\n" )
Response.write( "--------------------------------------------------------------------------------\n" )
g = Greeter(name = "ASPer")
Response.write( g.say_hi() + "\n" )
Response.write( g.say_bye() + "\n" )
Response.write( "\n" )

Response.write( "--------------------------------------------------------------------------------\n" )
Response.write( "Calling an ActiveX component\n" )
Response.write( "--------------------------------------------------------------------------------\n" )
d = Server.createObject("Scripting.Dictionary")
d.add("name", "Fabio Zendhi Nagao")
d.add("nickname", "nagaozen")
Response.write( d.Item("name") + "\n" )
Response.write( d.Item("nickname") + "\n" )
d = None
Response.write( "\n" )

Response.write( "--------------------------------------------------------------------------------\n" )
Response.write( "Calling ASP objects\n" )
Response.write( "--------------------------------------------------------------------------------\n" )
Session.SetValue("key", "session_value")
Response.write( Session("key") + "\n" )
Response.write( "\n" )
Response.write( Request.QueryString("qrystr") )
Response.write( "\n" )
Response.write( "\n" )
Response.write( "{" )
for variable in Request.ServerVariables:
	Response.write( "%s:%s, "%(variable, Request.ServerVariables(variable)) )
Response.write( "}\n" )
Response.write( "\n" )

#Response.write( "--------------------------------------------------------------------------------\n" )
#Response.write( "Calling Python Modules\n" )
#Response.write( "--------------------------------------------------------------------------------\n" )

#Response.write( "\n" )

Response.write( "--------------------------------------------------------------------------------\n" )
Response.write( "This source\n" )
Response.write( "--------------------------------------------------------------------------------\n" )
Response.write( read_text_file( Server.mapPath("python.lang.asp") ) )

%></pre>