当前位置: 首页>>代码示例>>Python>>正文


Python browser.FileManager类代码示例

本文整理汇总了Python中plone.resourceeditor.browser.FileManager的典型用法代码示例。如果您正苦于以下问题:Python FileManager类的具体用法?Python FileManager怎么用?Python FileManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了FileManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_download

    def test_download(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()
        r.writeFile("test.txt", "foo")

        view = FileManager(r, self.layer['request'])
        self.assertEqual("foo", view.download("/test.txt"))
开发者ID:CGTIC,项目名称:Plone_SP,代码行数:7,代码来源:tests.py

示例2: test_download

    def test_download(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()
        r.writeFile('test.txt', b'foo')

        view = FileManager(r, self.layer['request'])
        self.assertEqual(b'foo', view.download('/test.txt'))
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:7,代码来源:test_file_manager.py

示例3: test_getfolder

    def test_getfolder(self):
        from plone.resourceeditor.browser import FileManager

        r = self._make_directory()

        r.makeDirectory("alpha")
        r["alpha"].writeFile("beta.txt", "Beta")
        r["alpha"].makeDirectory("delta")
        r["alpha"]["delta"].writeFile("gamma.css", "body {}")

        view = FileManager(r, self.layer["request"])
        info = view.getFolder("/alpha")

        self.assertEqual(len(info), 2)

        self.assertEqual(info[0]["code"], 0)
        self.assertEqual(info[0]["error"], "")
        self.assertEqual(info[0]["fileType"], "dir")
        self.assertEqual(info[0]["filename"], "delta")
        self.assertEqual(info[0]["path"], "/alpha/delta")

        self.assertEqual(info[1]["code"], 0)
        self.assertEqual(info[1]["error"], "")
        self.assertEqual(info[1]["fileType"], "txt")
        self.assertEqual(info[1]["filename"], "beta.txt")
        self.assertEqual(info[1]["path"], "/alpha/beta.txt")
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:26,代码来源:tests.py

示例4: test_getfolder

    def test_getfolder(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()

        r.makeDirectory('alpha')
        r['alpha'].writeFile('beta.txt', b'Beta')
        r['alpha'].makeDirectory('delta')
        r['alpha']['delta'].writeFile('gamma.css', b'body')

        view = FileManager(r, self.layer['request'])
        info = view.getFolder('/alpha')

        self.assertEqual(len(info), 2)

        self.assertEqual(info[0]['code'], 0)
        self.assertEqual(info[0]['error'], '')
        self.assertEqual(info[0]['fileType'], 'dir')
        self.assertEqual(info[0]['filename'], 'delta')
        self.assertEqual(info[0]['path'], '/alpha/delta')

        self.assertEqual(info[1]['code'], 0)
        self.assertEqual(info[1]['error'], '')
        self.assertEqual(info[1]['fileType'], 'txt')
        self.assertEqual(info[1]['filename'], 'beta.txt')
        self.assertEqual(info[1]['path'], '/alpha/beta.txt')
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:25,代码来源:test_file_manager.py

示例5: test_resource_created_or_modified

 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'), '')
开发者ID:collective,项目名称:rapido.plone,代码行数:10,代码来源:test_handlers.py

示例6: test_addnew_invalidname

    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'], '')
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:10,代码来源:test_file_manager.py

示例7: test_addnew_invalidname

    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"], "")
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:11,代码来源:tests.py

示例8: test_delete_notfound

    def test_delete_notfound(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()

        view = FileManager(r, self.layer['request'])

        info = view.delete('/test.txt')

        self.assertEqual(info['code'], 1)
        self.assertNotEqual(info['error'], '')
        self.assertEqual(info['path'], '/test.txt')
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:11,代码来源:test_file_manager.py

示例9: test_delete_notfound

    def test_delete_notfound(self):
        from plone.resourceeditor.browser import FileManager

        r = self._make_directory()

        view = FileManager(r, self.layer["request"])

        info = view.delete("/test.txt")

        self.assertEqual(info["code"], 1)
        self.assertNotEqual(info["error"], "")
        self.assertEqual(info["path"], "/test.txt")
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:12,代码来源:tests.py

示例10: test_addfolder_invalid_parent

    def test_addfolder_invalid_parent(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()

        view = FileManager(r, self.layer['request'])

        info = view.addFolder('/alpha', 'beta')

        self.assertEqual(info['code'], 1)
        self.assertNotEqual(info['error'], '')
        self.assertEqual(info['parent'], '/alpha')
        self.assertEqual(info['name'], 'beta')
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:12,代码来源:test_file_manager.py

示例11: test_addfolder_invalid_parent

    def test_addfolder_invalid_parent(self):
        from plone.resourceeditor.browser import FileManager

        r = self._make_directory()

        view = FileManager(r, self.layer["request"])

        info = view.addFolder("/alpha", "beta")

        self.assertEqual(info["code"], 1)
        self.assertNotEqual(info["error"], "")
        self.assertEqual(info["parent"], "/alpha")
        self.assertEqual(info["name"], "beta")
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:13,代码来源:tests.py

示例12: test_addnew_exists

    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')
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:13,代码来源:test_file_manager.py

示例13: test_addfolder_invalid_name

    def test_addfolder_invalid_name(self):
        from plone.resourceeditor.browser import FileManager
        r = self._make_directory()
        r.makeDirectory('alpha')

        view = FileManager(r, self.layer['request'])

        for char in '\\/:*?"<>':
            info = view.addFolder('/', 'foo' + char)

            self.assertEqual(info['code'], 1)
            self.assertNotEqual(info['error'], '')
            self.assertEqual(info['parent'], '/')
            self.assertEqual(info['name'], 'foo' + char)
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:14,代码来源:test_file_manager.py

示例14: test_addnew_exists

    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")
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:14,代码来源:tests.py

示例15: test_move_invalid_parent

    def test_move_invalid_parent(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.move('/test.txt', '/alpha')

        self.assertEqual(info['code'], 1)
        self.assertNotEqual(info['error'], '')
        self.assertEqual(info['newPath'], '/alpha/test.txt')

        self.assertTrue('test.txt' in r)
开发者ID:plone,项目名称:plone.resourceeditor,代码行数:14,代码来源:test_file_manager.py


注:本文中的plone.resourceeditor.browser.FileManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。