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


Python browser.ZodbInfoView类代码示例

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


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

示例1: createView

 def createView(self, obj):
     view = ZodbInfoView(obj, TestRequest())
     view.obj = obj
     view.state = ZodbObjectStateStub(view.obj)
     view.requestedTid = None
     view.getRootOid = lambda: 1
     return view
开发者ID:imclab,项目名称:zodbbrowser,代码行数:7,代码来源:test_browser.py

示例2: test_loadHistoricalState

 def test_loadHistoricalState(self):
     view = ZodbInfoView(None, None)
     view.obj = None
     view.history = [{}]  # injected fault: KeyError('tid')
     self.assertEqual(view._loadHistoricalState(),
                      [{'state': {}, 'error': "KeyError: 'tid'"},
                       {'state': {}, 'error': None}])
开发者ID:mgedmin,项目名称:zodbbrowser,代码行数:7,代码来源:test_browser.py

示例3: testFindClosestPersistent

 def testFindClosestPersistent(self):
     view = ZodbInfoView(self.root['stub']['member'], TestRequest())
     self.assertEquals(view.findClosestPersistent(), self.root['stub'])
     view = ZodbInfoView(self.root['stub']['member']['notpersistent'],
                         TestRequest())
     self.assertEquals(view.findClosestPersistent(),
                       None)
开发者ID:imclab,项目名称:zodbbrowser,代码行数:7,代码来源:test_browser.py

示例4: testGetUrl

 def testGetUrl(self):
     view = self._zodbInfoView(self.root, TestRequest())
     self.assertEquals(view.getUrl(), '@@zodbbrowser?oid=0x%x' %
                       u64(self.root._p_oid))
     view = self._zodbInfoView(self.root, TestRequest())
     self.assertEquals(view.getUrl(1, 2), '@@zodbbrowser?oid=0x1&tid=0x2')
     view = ZodbInfoView(self.root, TestRequest(form={'tid': '2'}))
     self.assertEquals(view.getUrl(1), '@@zodbbrowser?oid=0x1&tid=2')
开发者ID:imclab,项目名称:zodbbrowser,代码行数:8,代码来源:test_browser.py

示例5: test_listItems

 def test_listItems(self):
     view = ZodbInfoView(None, None)
     view.state = ZodbObjectStateStub(PersistentStub())
     view.state.requestedTid = 42
     view.state.listItems = lambda: [('zoinks', 17),
                                     ('scoobysnack', None)]
     self.assertEquals(view.listItems(),
                       [ZodbObjectAttribute('zoinks', 17, 42),
                        ZodbObjectAttribute('scoobysnack', None, 42)])
开发者ID:imclab,项目名称:zodbbrowser,代码行数:9,代码来源:test_browser.py

示例6: test_getBreadcrumbsHTML

 def test_getBreadcrumbsHTML(self):
     view = ZodbInfoView(None, None)
     view.getBreadcrumbs = lambda: [('/', 'here'),
                                    ('foo>', 'so"there'),
                                    ('/', None),
                                    ('bar<baz', None)]
     self.assertEquals(view.getBreadcrumbsHTML(),
                       '<a href="here">/</a>'
                       '<a href="so&quot;there">foo&gt;</a>'
                       '/bar&lt;baz')
开发者ID:imclab,项目名称:zodbbrowser,代码行数:10,代码来源:test_browser.py

示例7: testGetRequestedTid

 def testGetRequestedTid(self):
     view = ZodbInfoView(self.root, TestRequest())
     self.assertEquals(view.getRequestedTid(), None)
     self.assertEquals(view.getRequestedTidNice(), None)
     view = ZodbInfoView(self.root,
                         TestRequest(form={'tid': '12345678912345678'}))
     self.assertEquals(view.getRequestedTid(), '12345678912345678')
     self.assertEquals(view.getRequestedTidNice(),
                       '1905-05-13 03:32:22.050327')
开发者ID:imclab,项目名称:zodbbrowser,代码行数:9,代码来源:test_browser.py

示例8: test_listItems_empty

 def test_listItems_empty(self):
     view = ZodbInfoView(None, None)
     view.state = ZodbObjectStateStub(PersistentStub())
     view.state.listItems = lambda: []
     self.assertEquals(view.listItems(), [])
开发者ID:imclab,项目名称:zodbbrowser,代码行数:5,代码来源:test_browser.py

示例9: test_listAttributes_none_exist

 def test_listAttributes_none_exist(self):
     view = ZodbInfoView(None, None)
     view.state = ZodbObjectStateStub(PersistentStub())
     view.state.requestedTid = 42
     view.state.listAttributes = lambda: None
     self.assertEquals(view.listAttributes(), None)
开发者ID:imclab,项目名称:zodbbrowser,代码行数:6,代码来源:test_browser.py

示例10: _zodbInfoView

 def _zodbInfoView(self, obj, request):
     view = ZodbInfoView(obj, request)
     view.template = lambda: ''
     view()
     return view
开发者ID:imclab,项目名称:zodbbrowser,代码行数:5,代码来源:test_browser.py

示例11: test_getPath

 def test_getPath(self):
     view = ZodbInfoView(None, None)
     view.getBreadcrumbs = lambda: [('/', None), ('foo', None),
                                    ('/', None), ('bar baz', None)]
     self.assertEquals(view.getPath(), '/foo/bar baz')
开发者ID:imclab,项目名称:zodbbrowser,代码行数:5,代码来源:test_browser.py

示例12: testSelectObjectToView_use_context

 def testSelectObjectToView_use_context(self):
     view = ZodbInfoView(self.root, TestRequest())
     self.assertEquals(view.selectObjectToView(), self.root)
     view = ZodbInfoView(self.root['root']['item'], TestRequest())
     self.assertEquals(view.selectObjectToView(), self.root['root']['item'])
开发者ID:imclab,项目名称:zodbbrowser,代码行数:5,代码来源:test_browser.py

示例13: testSelectObjectToView_find_parent

 def testSelectObjectToView_find_parent(self):
     view = ZodbInfoView(self.root['stub']['member'], TestRequest())
     self.assertEquals(view.selectObjectToView(), self.root['stub'])
开发者ID:imclab,项目名称:zodbbrowser,代码行数:3,代码来源:test_browser.py

示例14: testSelectObjectToView_find_parent_fail_fall_back_to_root

 def testSelectObjectToView_find_parent_fail_fall_back_to_root(self):
     view = ZodbInfoView(self.root['stub']['member']['notpersistent'], TestRequest())
     view.jar = self.root._p_jar
     self.assertEquals(view.selectObjectToView(), self.root)
开发者ID:imclab,项目名称:zodbbrowser,代码行数:4,代码来源:test_browser.py

示例15: testSelectObjectToView_by_oid

 def testSelectObjectToView_by_oid(self):
     oid = u64(self.root['stub']._p_oid)
     view = ZodbInfoView(self.root, TestRequest(form={'oid': str(oid)}))
     self.assertEquals(view.selectObjectToView(), self.root['stub'])
开发者ID:imclab,项目名称:zodbbrowser,代码行数:4,代码来源:test_browser.py


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