當前位置: 首頁>>代碼示例>>Python>>正文


Python IDataStorage.add方法代碼示例

本文整理匯總了Python中collective.tablepage.interfaces.IDataStorage.add方法的典型用法代碼示例。如果您正苦於以下問題:Python IDataStorage.add方法的具體用法?Python IDataStorage.add怎麽用?Python IDataStorage.add使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在collective.tablepage.interfaces.IDataStorage的用法示例。


在下文中一共展示了IDataStorage.add方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setUp

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def setUp(self):
     portal = self.layer['portal']
     self.tp_catalog = portal.tablepage_catalog
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []},
                           ],
             batchSize=10)
     tp.edit(searchConfig=[{'id': 'foo_field', 'label': '', 'description': '',
                            'additionalConfiguration': ['SearchableText']}])
     self.tp = tp
     self.storage = IDataStorage(tp)
     self._addRows(35)
     # now adding another tablepage: this must be always ignored by searches
     portal.invokeFactory(type_name='TablePage', id='table_page2', title="Another Table Document")
     portal.table_page2.edit(pageColumns=[{'id': 'foo_field', 'label': 'Foo field', 'description': '',
                                           'type': 'String', 'vocabulary': '', 'options': []},
                                           ],
                                           batchSize=10)
     storage2 = IDataStorage(portal.table_page2)
     storage2.add({'__label__': 'A Label', '__uuid__': 'l2l2l2'})
     storage2.add({'foo_field': 'aa001', '__uuid__': '010'})
     portal.portal_workflow.doActionFor(tp, 'publish')
     self.tp_catalog.clearFindAndRebuild()
     logout()
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:29,代碼來源:test_search.py

示例2: test_computed_general_tal_access

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_computed_general_tal_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'simple_column': 'Lorem ipsum'})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = 'portal/title'
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'Plone site')
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:11,代碼來源:test_computed_field.py

示例3: test_computed_file_access

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_computed_file_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'column_file': portal.file1.UID()})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = 'row/column_file/Title'
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'One file')
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:11,代碼來源:test_computed_field.py

示例4: test_computed_multiple_files_access

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_computed_multiple_files_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'column_files': "%s\n%s" % (portal.file1.UID(), portal.file2.UID())})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = "python:row['column_files'][1].Title()"
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'Another file')
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:11,代碼來源:test_computed_field.py

示例5: test_url_edit

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_url_edit(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': 'http://foo.com/',
                  '__uuid__': 'aaa'})
     request.form['row-index'] = 0
     view = getMultiAdapter((tp, request), name=u'edit-record')
     self.assertTrue('http://foo.com/' in view())
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:12,代碼來源:test_link_field.py

示例6: test_reference_document_edit

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_reference_document_edit(self):
     portal = self.layer['portal']
     request = self.layer['request']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': portal.document.UID(),
                  '__uuid__': 'aaa'})
     request.form['row-index'] = 0
     view = getMultiAdapter((tp, request), name=u'edit-record')
     self.assertTrue('value="%s"' % portal.document.Title().decode('utf-8') in view())
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:12,代碼來源:test_link_field.py

示例7: test_template_override_icon

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_template_override_icon(self):
     portal = self.layer['portal']
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'link', 'label': 'Link', 'description': '',
                           'type': 'Link', 'vocabulary': 'icon:src-to-an-icon', 'options': []}])
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': portal.document.UID(),
                  '__uuid__': 'aaa'})
     output = tp()
     self.assertTrue(u'<img src="src-to-an-icon" alt="A d\xf2cument to reference" />' in output)
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:12,代碼來源:test_link_field.py

示例8: test_template_override_text

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_template_override_text(self):
     portal = self.layer['portal']
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'link', 'label': 'Link', 'description': '',
                           'type': 'Link', 'vocabulary': 'title:Lorèm ipsum', 'options': []}])
     storage = IDataStorage(tp)
     storage.add({'__creator__': TEST_USER_NAME, 'link': portal.document.UID(),
                  '__uuid__': 'aaa'})
     output = tp()
     self.assertTrue(u'Lor\xe8m ipsum' in output)
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:12,代碼來源:test_link_field.py

示例9: test_computed_link_access

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_computed_link_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'column_link': portal.document.UID()})
     storage.add({'column_link': 'http://plone.org/'})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = "row/column_link/Title|row/column_link"
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'A document to reference')
     self.assertEquals(field.render_view('foo', 1).strip(), 'http://plone.org/')
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:13,代碼來源:test_computed_field.py

示例10: test_modify_his_row

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_modify_his_row(self):
     """user2 can't modify other user's data"""
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo data from user1',
                  '__uuid__': 'aaa'})
     login(portal, 'user2')
     view = tp.restrictedTraverse('@@edit-record')
     view.request.form['row-index'] = 0
     self.assertRaises(Unauthorized, view)
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:13,代碼來源:test_security.py

示例11: test_move_my_row

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_move_my_row(self):
     """Owners normally can't move rows"""
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo data from user1',
                  '__uuid__': 'aaa'})
     storage.add({'__creator__': 'user1', 'col_a': 'some other futile data',
                  '__uuid__': 'bbb'})
     login(portal, 'user1')
     self.assertRaises(Unauthorized, tp.restrictedTraverse, '@@move-record')
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:13,代碼來源:test_security.py

示例12: test_view_forbidden_attachment

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_view_forbidden_attachment(self):
     """Although attachment is not accessible, normal table visitor can see the link"""
     portal = self.layer['portal']
     tp = portal.table_page
     folder = portal.folder
     tp.manage_setLocalRoles('user0', ('Contributor',))
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user0', 'att': folder.attachment.UID(),
                  '__uuid__': 'aaa'})
     logout()
     self.assertTrue('An ancient attachment' in tp())
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:13,代碼來源:test_file_field.py

示例13: test_rows_var_access

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_rows_var_access(self):
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'simple_column': 'Lorem ipsum'})
     configuration = tp.getPageColumns()
     configuration[-1]['vocabulary'] = "python:rows.get(0)['simple_column']"
     field = self._getField()
     self.assertEquals(field.render_view('foo', 0).strip(), 'Lorem ipsum')
     storage.add({'simple_column': 'dolor sit amet'})
     field = self._getField()
     self.assertEquals(field.render_view('foo', 1).strip(), 'Lorem ipsum')
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:14,代碼來源:test_computed_field.py

示例14: test_delete_my_row

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def test_delete_my_row(self):
     """Owners can delete proper rows"""
     portal = self.layer['portal']
     tp = portal.table_page
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'foo data from user1',
                  '__uuid__': 'aaa'})
     login(portal, 'user1')
     view = tp.restrictedTraverse('@@delete-record')
     view.request.form['row-index'] = 0
     view()
     self.assertEqual(len(storage), 0)
開發者ID:Vinsurya,項目名稱:Plone,代碼行數:14,代碼來源:test_security.py

示例15: setUp

# 需要導入模塊: from collective.tablepage.interfaces import IDataStorage [as 別名]
# 或者: from collective.tablepage.interfaces.IDataStorage import add [as 別名]
 def setUp(self):
     portal = self.layer['portal']
     login(portal, TEST_USER_NAME)
     portal.invokeFactory(type_name='TablePage', id='table_page', title="The Table Document")
     tp = portal.table_page
     tp.edit(pageColumns=[{'id': 'col_a', 'label': 'Col A', 'description': '',
                           'type': 'String', 'vocabulary': '', 'options': []}])
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user1', 'col_a': 'Lorem', '__uuid__': 'aaa'})
     storage.add({'__creator__': 'user1', 'col_a': 'Ipsum', '__uuid__': 'bbb'})
     storage.add({'__creator__': 'user1', 'col_a': 'Sit', '__uuid__': 'ccc'})
     self.tp_catalog = getToolByName(portal, 'tablepage_catalog')
開發者ID:collective,項目名稱:collective.tablepage,代碼行數:14,代碼來源:test_view.py


注:本文中的collective.tablepage.interfaces.IDataStorage.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。