本文整理汇总了Python中ZPublisher.HTTPRequest.HTTPRequest.processInputs方法的典型用法代码示例。如果您正苦于以下问题:Python HTTPRequest.processInputs方法的具体用法?Python HTTPRequest.processInputs怎么用?Python HTTPRequest.processInputs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZPublisher.HTTPRequest.HTTPRequest
的用法示例。
在下文中一共展示了HTTPRequest.processInputs方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: decodeQueryString
# 需要导入模块: from ZPublisher.HTTPRequest import HTTPRequest [as 别名]
# 或者: from ZPublisher.HTTPRequest.HTTPRequest import processInputs [as 别名]
def decodeQueryString(QueryString):
"""decode *QueryString* into a dictionary, as ZPublisher would do"""
r= HTTPRequest(None,
{'QUERY_STRING' : QueryString,
'SERVER_URL' : '',
},
None,1)
r.processInputs()
return r.form
示例2: testRemoveStdinReferences
# 需要导入模块: from ZPublisher.HTTPRequest import HTTPRequest [as 别名]
# 或者: from ZPublisher.HTTPRequest.HTTPRequest import processInputs [as 别名]
def testRemoveStdinReferences(self):
# Verifies that all references to the input stream go away on
# request.close(). Otherwise a tempfile may stick around.
import sys
from StringIO import StringIO
s = StringIO(TEST_FILE_DATA)
env = TEST_ENVIRON.copy()
start_count = sys.getrefcount(s)
from ZPublisher.HTTPRequest import HTTPRequest
req = HTTPRequest(s, env, None)
req.processInputs()
self.assertNotEqual(start_count, sys.getrefcount(s)) # Precondition
req.close()
self.assertEqual(start_count, sys.getrefcount(s)) # The test
示例3: testFileIterator
# 需要导入模块: from ZPublisher.HTTPRequest import HTTPRequest [as 别名]
# 或者: from ZPublisher.HTTPRequest.HTTPRequest import processInputs [as 别名]
def testFileIterator(self):
# checks fileupload object supports the iterator protocol
# collector entry 1837
import sys
from StringIO import StringIO
s = StringIO(TEST_FILE_DATA)
env = TEST_ENVIRON.copy()
from ZPublisher.HTTPRequest import HTTPRequest
req = HTTPRequest(s, env, None)
req.processInputs()
f=req.form.get('file')
self.assertEqual(list(f),['test\n'])
f.seek(0)
self.assertEqual(f.next(),'test\n')
f.seek(0)
self.assertEqual(f.xreadlines(),f)
示例4: makerequest
# 需要导入模块: from ZPublisher.HTTPRequest import HTTPRequest [as 别名]
# 或者: from ZPublisher.HTTPRequest.HTTPRequest import processInputs [as 别名]
def makerequest(environ=None, stdin=''):
stdout = StringIO()
stdin = StringIO(stdin)
if environ is None:
environ = {}
# Header-Name -> HEADER_NAME
_ = {}
for k,v in environ.items():
k = k.replace('-', '_').upper()
_[k] = v
environ = _
response = HTTPResponse(stdout=stdout)
environ.setdefault('SERVER_NAME', 'foo')
environ.setdefault('SERVER_PORT', '80')
request = HTTPRequest(stdin, environ, response)
# process stdin data
request.processInputs()
return request
示例5: makeFileUpload
# 需要导入模块: from ZPublisher.HTTPRequest import HTTPRequest [as 别名]
# 或者: from ZPublisher.HTTPRequest.HTTPRequest import processInputs [as 别名]
def makeFileUpload(data, filename):
request_data = upload_request.format(filename, len(data), data)
req = HTTPRequest(StringIO(request_data), test_environment.copy(), None)
req.processInputs()
return req.form.get('file')