当前位置: 首页>>代码示例>>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;未经允许,请勿转载。