本文整理汇总了Python中plone.resourceeditor.browser.FileManager.addNew方法的典型用法代码示例。如果您正苦于以下问题:Python FileManager.addNew方法的具体用法?Python FileManager.addNew怎么用?Python FileManager.addNew使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类plone.resourceeditor.browser.FileManager
的用法示例。
在下文中一共展示了FileManager.addNew方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_addnew_invalidname
# 需要导入模块: from plone.resourceeditor.browser import FileManager [as 别名]
# 或者: from plone.resourceeditor.browser.FileManager import addNew [as 别名]
def test_addnew_invalidname(self):
from plone.resourceeditor.browser import FileManager
r = self._make_directory()
view = FileManager(r, self.layer['request'])
for char in '\\/:*?"<>':
info = view.addNew('/', 'foo' + char)
self.assertEqual(info['code'], 1)
self.assertNotEqual(info['error'], '')
示例2: test_resource_created_or_modified
# 需要导入模块: from plone.resourceeditor.browser import FileManager [as 别名]
# 或者: from plone.resourceeditor.browser.FileManager import addNew [as 别名]
def test_resource_created_or_modified(self):
request = FakeRequest()
r = self._make_directory()
view = FileManager(r, request)
info = view.addNew('/', 'test_tile.yaml')
self.assertEqual(info['code'], 0)
self.assertEqual(info['error'], '')
self.assertEqual(info['name'], 'test_tile.yaml')
self.assertEqual(info['parent'], '/')
self.assertEqual(r.readFile('test_tile.yaml'), '')
示例3: test_addnew_invalidname
# 需要导入模块: from plone.resourceeditor.browser import FileManager [as 别名]
# 或者: from plone.resourceeditor.browser.FileManager import addNew [as 别名]
def test_addnew_invalidname(self):
from plone.resourceeditor.browser import FileManager
r = self._make_directory()
view = FileManager(r, self.layer["request"])
for char in '\\/:*?"<>':
info = view.addNew("/", "foo" + char)
self.assertEqual(info["code"], 1)
self.assertNotEqual(info["error"], "")
示例4: test_addnew_exists
# 需要导入模块: from plone.resourceeditor.browser import FileManager [as 别名]
# 或者: from plone.resourceeditor.browser.FileManager import addNew [as 别名]
def test_addnew_exists(self):
from plone.resourceeditor.browser import FileManager
r = self._make_directory()
r.writeFile('test.txt', b'foo')
view = FileManager(r, self.layer['request'])
info = view.addNew('/', 'test.txt')
self.assertEqual(info['code'], 1)
self.assertNotEqual(info['error'], '')
self.assertEqual(r.readFile('test.txt'), b'foo')
示例5: test_addnew_exists
# 需要导入模块: from plone.resourceeditor.browser import FileManager [as 别名]
# 或者: from plone.resourceeditor.browser.FileManager import addNew [as 别名]
def test_addnew_exists(self):
from plone.resourceeditor.browser import FileManager
r = self._make_directory()
r.writeFile("test.txt", "foo")
view = FileManager(r, self.layer["request"])
info = view.addNew("/", "test.txt")
self.assertEqual(info["code"], 1)
self.assertNotEqual(info["error"], "")
self.assertEqual(r.readFile("test.txt"), "foo")
示例6: test_addnew
# 需要导入模块: from plone.resourceeditor.browser import FileManager [as 别名]
# 或者: from plone.resourceeditor.browser.FileManager import addNew [as 别名]
def test_addnew(self):
from plone.resourceeditor.browser import FileManager
r = self._make_directory()
view = FileManager(r, self.layer['request'])
info = view.addNew('/', 'test.txt')
self.assertEqual(info['code'], 0)
self.assertEqual(info['error'], '')
self.assertEqual(info['name'], 'test.txt')
self.assertEqual(info['parent'], '/')
self.assertEqual(r.readFile('test.txt'), b'')
示例7: test_addnew
# 需要导入模块: from plone.resourceeditor.browser import FileManager [as 别名]
# 或者: from plone.resourceeditor.browser.FileManager import addNew [as 别名]
def test_addnew(self):
from plone.resourceeditor.browser import FileManager
r = self._make_directory()
view = FileManager(r, self.layer["request"])
info = view.addNew("/", "test.txt")
self.assertEqual(info["code"], 0)
self.assertEqual(info["error"], "")
self.assertEqual(info["name"], "test.txt")
self.assertEqual(info["parent"], "/")
self.assertEqual(r.readFile("test.txt"), "")