本文整理匯總了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