本文整理汇总了Python中mod_python.apache.OK属性的典型用法代码示例。如果您正苦于以下问题:Python apache.OK属性的具体用法?Python apache.OK怎么用?Python apache.OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类mod_python.apache
的用法示例。
在下文中一共展示了apache.OK属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: edit
# 需要导入模块: from mod_python import apache [as 别名]
# 或者: from mod_python.apache import OK [as 别名]
def edit(UI):
"""Edit the requested Directory object page."""
# Locate the requested Directory object.
reqID = UI.requestParams.value('ID', '0')
reqDir = objectservers.recall('Directory', reqID)
reqDir.name = UI.requestParams.value('name', '')
# Write page out to the client.
UI.write_header('Directory %s' % reqID)
UI.write("<body>You just edited Directory record %s, %s" % \
(reqID, reqDir.name()))
UI.write("</body></html>")
return UI.OK
########### ASP ###########
############
# uiasp.py #
############
示例2: __init__
# 需要导入模块: from mod_python import apache [as 别名]
# 或者: from mod_python.apache import OK [as 别名]
def __init__(self, aRequest):
self.OK = apache.OK
self.HTTP_NOT_ACCEPTABLE = apache.HTTP_NOT_ACCEPTABLE
# Set response hook to equal the Request object.
self.response = aRequest
self.load_params(aRequest)
# Set uri data from Request object.
if aRequest.protocol.count('HTTPS') > 0: self.protocol = 'https'
rawIP, self.port = aRequest.connection.local_addr
self.hostname = aRequest.hostname
atoms = aRequest.uri.split("/")
self.script = atoms.pop()
self.path = "/".join(atoms)
self.user = aRequest.user
# Retrieve the submitted parameters from Apache/mod_python.
# ONLY CALL ONCE per request.
newData = util.FieldStorage(aRequest, 1).list
self.requestParams.flush()
if newData is not None:
for eachParam in newData:
self.requestParams.add_param(str(eachParam.name),
str(eachParam.value))
示例3: handler
# 需要导入模块: from mod_python import apache [as 别名]
# 或者: from mod_python.apache import OK [as 别名]
def handler(req):
options = req.get_options()
# Run a startup function if requested.
global startup
if 'wsgi.startup' in options and not startup:
func = options['wsgi.startup']
if func:
module_name, object_str = func.split('::', 1)
module = __import__(module_name, globals(), locals(), [''])
startup = apache.resolve_object(module, object_str)
startup(req)
# Register a cleanup function if requested.
global cleanup
if 'wsgi.cleanup' in options and not cleanup:
func = options['wsgi.cleanup']
if func:
module_name, object_str = func.split('::', 1)
module = __import__(module_name, globals(), locals(), [''])
cleanup = apache.resolve_object(module, object_str)
def cleaner(data):
cleanup()
try:
# apache.register_cleanup wasn't available until 3.1.4.
apache.register_cleanup(cleaner)
except AttributeError:
req.server.register_cleanup(req, cleaner)
# Import the wsgi 'application' callable and pass it to Handler.run
global wsgiapps
appini = options.get('paste.ini')
app = None
if appini:
if appini not in wsgiapps:
wsgiapps[appini] = loadapp("config:%s" % appini)
app = wsgiapps[appini]
# Import the wsgi 'application' callable and pass it to Handler.run
appwsgi = options.get('wsgi.application')
if appwsgi and not appini:
modname, objname = appwsgi.split('::', 1)
module = __import__(modname, globals(), locals(), [''])
app = getattr(module, objname)
Handler(req).run(app)
# status was set in Handler; always return apache.OK
return apache.OK