本文整理汇总了Python中six.StringIO.filename方法的典型用法代码示例。如果您正苦于以下问题:Python StringIO.filename方法的具体用法?Python StringIO.filename怎么用?Python StringIO.filename使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类six.StringIO
的用法示例。
在下文中一共展示了StringIO.filename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testWebDavUpdate
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import filename [as 别名]
def testWebDavUpdate(self):
image = StringIO(getImage())
image.filename = 'original.gif'
base = '/'.join(self.folder.getPhysicalPath())
response = self.publish(base + '/foo-image', request_method='PUT',
stdin=image, basic=self.getCredentials(),
env={'CONTENT_TYPE': 'image/gif'})
self.assertEqual(response.getStatus(), 204)
self.assertTrue('foo-image' in self.folder.objectIds())
fooimage = self.folder['foo-image']
self.assertEqual(fooimage.getId(), 'foo-image')
self.assertEqual(fooimage.Title(), 'an image')
# as opposed to during file upload, editing a file via webdav (e.g.
# using the "external editor" feature) should not change the filename
self.assertEqual(fooimage.getFilename(), 'original.gif')
示例2: testWebDavUpload
# 需要导入模块: from six import StringIO [as 别名]
# 或者: from six.StringIO import filename [as 别名]
def testWebDavUpload(self):
image = StringIO(getImage())
image.filename = 'original.gif'
base = '/'.join(self.folder.getPhysicalPath())
response = self.publish(base + '/image', request_method='PUT',
stdin=image, basic=self.getCredentials(),
env={'CONTENT_TYPE': 'image/gif'})
self.assertEqual(response.getStatus(), 201)
self.assertTrue('image' in self.folder.objectIds())
obj = self.folder.image
self.assertEqual(obj.getPortalTypeName(), 'Image')
self.assertTrue(IATBlobImage.providedBy(obj), 'no blob?')
self.assertEqual(str(obj.getField('image').get(obj)), image.getvalue())
# on initial (webdav) upload no filename is set by the client,
# so it should end up being equal to the last path/url component...
self.assertEqual(obj.getFilename(), 'image')