本文整理汇总了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
示例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}])
示例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)
示例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')
示例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)])
示例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"there">foo></a>'
'/bar<baz')
示例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')
示例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(), [])
示例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)
示例10: _zodbInfoView
def _zodbInfoView(self, obj, request):
view = ZodbInfoView(obj, request)
view.template = lambda: ''
view()
return view
示例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')
示例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'])
示例13: testSelectObjectToView_find_parent
def testSelectObjectToView_find_parent(self):
view = ZodbInfoView(self.root['stub']['member'], TestRequest())
self.assertEquals(view.selectObjectToView(), self.root['stub'])
示例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)
示例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'])