當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。