当前位置: 首页>>代码示例>>Python>>正文


Python CGIHTTPServer.test方法代码示例

本文整理汇总了Python中CGIHTTPServer.test方法的典型用法代码示例。如果您正苦于以下问题:Python CGIHTTPServer.test方法的具体用法?Python CGIHTTPServer.test怎么用?Python CGIHTTPServer.test使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CGIHTTPServer的用法示例。


在下文中一共展示了CGIHTTPServer.test方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import CGIHTTPServer [as 别名]
# 或者: from CGIHTTPServer import test [as 别名]
def main():
	class MyRequestHandler(CGIHTTPServer.CGIHTTPRequestHandler):

		def _is_cgi(self):
			path = self.path

			x = '/cgi-bin/htmlhelp.cgi'
			i = len(x)
			if path[:i] == x and (not path[i:] or path[i] == '/'):
				self.cgi_info = '', path[1:i]
				return 1
			return 0
	
	CGIHTTPServer.test(MyRequestHandler)
开发者ID:BackupTheBerlios,项目名称:htmlhelp-svn,代码行数:16,代码来源:testcgi.py

示例2:

# 需要导入模块: import CGIHTTPServer [as 别名]
# 或者: from CGIHTTPServer import test [as 别名]
#!/usr/bin/env python
# _* config: utf-8 _*_

import CGIHTTPServer
CGIHTTPServer.test()
开发者ID:soel,项目名称:My_training,代码行数:7,代码来源:cgiserver.py

示例3: translate_path

# 需要导入模块: import CGIHTTPServer [as 别名]
# 或者: from CGIHTTPServer import test [as 别名]
				break
			head, tail = head[:i], head[i:] + tail
			temp = self.translate_path(head)

		if os.path.isdir(temp):
			for index in self.indices:
				if os.path.exists(os.path.join(temp, index)):
					head = posixpath.join(head, index)
					break

		ctype = self.guess_type(head)
		if ctype in self.actions:
			os.environ['REDIRECT_STATUS'] = '200'			
			head = self.actions[ctype] + head

		self.path = head + tail + query

	def translate_path(self, path):
		path = posixpath.normpath(urllib.unquote(path))
		n = len(self.aliases)
		for i in range(n):
			url, dir = self.aliases[n-i-1]
			length = len(url)
			if path[:length] == url:
				return dir + path[length:]
		return ''


if __name__ == '__main__':
	CGIHTTPServer.test(PHPHTTPRequestHandler)
开发者ID:Estevo-Aleixo,项目名称:htmlhelp,代码行数:32,代码来源:PHPHTTPServer.py

示例4: test

# 需要导入模块: import CGIHTTPServer [as 别名]
# 或者: from CGIHTTPServer import test [as 别名]
def test(HandlerClass = PTestCGIHandler,
         ServerClass = BaseHTTPServer.HTTPServer):
    CGIHTTPServer.test(HandlerClass, ServerClass)
开发者ID:pythontech,项目名称:psync,代码行数:5,代码来源:ptestcgi.py

示例5: print

# 需要导入模块: import CGIHTTPServer [as 别名]
# 或者: from CGIHTTPServer import test [as 别名]
# -*- coding: utf-8 -*-
import CGIHTTPServer
if __name__ == '__main__':
    print('あああ')
    CGIHTTPServer.test();

开发者ID:nagaohiroki,项目名称:python_study,代码行数:7,代码来源:CGiServer.py

示例6: test

# 需要导入模块: import CGIHTTPServer [as 别名]
# 或者: from CGIHTTPServer import test [as 别名]
def test(HandlerClass = SymfonyHTTPRequestHandler, ServerClass = HTTPServer):
    CGIHTTPServer.test(HandlerClass, ServerClass)
开发者ID:bhuztez,项目名称:SymfonyHTTPServer,代码行数:4,代码来源:SymfonyHTTPServer.py

示例7: PyCGIHandler

# 需要导入模块: import CGIHTTPServer [as 别名]
# 或者: from CGIHTTPServer import test [as 别名]
#!/usr/bin/env python

import os
import CGIHTTPServer

class PyCGIHandler(CGIHTTPServer.CGIHTTPRequestHandler):
    def is_cgi(self):
        splitpath = CGIHTTPServer._url_collapse_path_split(self.path)
        script_query = splitpath[1].split("?", 1)
        if script_query[0].endswith(".py"):
            if splitpath[0].startswith("/"):
                # Workaround for some weirdness with how CGIHTTPServer
                # computes the SCRIPT_NAME environment variable.
                splitpath = list(splitpath)
                splitpath[0] = ''
                splitpath = tuple(splitpath)
            self.cgi_info = splitpath
            return True
        return False

os.chdir("www")
CGIHTTPServer.test(HandlerClass=PyCGIHandler)
开发者ID:jfly,项目名称:stackmat,代码行数:24,代码来源:test_server.py


注:本文中的CGIHTTPServer.test方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。