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


Python interfaces.IDataStorage类代码示例

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


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

示例1: test_computed_file_access

 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,代码行数:9,代码来源:test_computed_field.py

示例2: test_computed_multiple_files_access

 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,代码行数:9,代码来源:test_computed_field.py

示例3: test_computed_general_tal_access

 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,代码行数:9,代码来源:test_computed_field.py

示例4: test_url_edit

 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,代码行数:10,代码来源:test_link_field.py

示例5: test_reference_document_edit

 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,代码行数:10,代码来源:test_link_field.py

示例6: test_template_override_icon

 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,代码行数:10,代码来源:test_link_field.py

示例7: test_template_override_text

 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,代码行数:10,代码来源:test_link_field.py

示例8: test_computed_link_access

 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,代码行数:11,代码来源:test_computed_field.py

示例9: test_view_forbidden_attachment

 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,代码行数:11,代码来源:test_file_field.py

示例10: test_modify_his_row

 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,代码行数:11,代码来源:test_security.py

示例11: test_move_my_row

 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,代码行数:11,代码来源:test_security.py

示例12: test_rows_var_access

 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,代码行数:12,代码来源:test_computed_field.py

示例13: test_frontend_url

 def test_frontend_url(self):
     """We will have resolveuid URL in backend, but real URL on table view"""
     tp = self.tp
     request = self.layer['request']
     portal = self.layer['portal']
     storage = IDataStorage(tp)
     storage.add({'__creator__': 'user0', 'att': portal.folder.attachment1.UID(),
                  '__uuid__': 'aaa'})
     view = getMultiAdapter((tp, request), name='tablepage-edit')
     self.assertTrue('href="resolveuid/%s/at_download/file"' % \
                                 portal.folder.attachment1.UID() in view())
     self.assertTrue('href="http://nohost/plone/folder/attachment1/at_download/file"' in tp())
开发者ID:Vinsurya,项目名称:Plone,代码行数:12,代码来源:test_file_field.py

示例14: test_delete_my_row

 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,代码行数:12,代码来源:test_security.py

示例15: test_editor_modify_his_row

 def test_editor_modify_his_row(self):
     """user3 can 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, 'user3')
     view = tp.restrictedTraverse('@@edit-record')
     view.request.form['row-index'] = 0
     self.assertTrue('Edit row' in view())
     self.assertTrue('foo data from user1' in view())
开发者ID:Vinsurya,项目名称:Plone,代码行数:12,代码来源:test_security.py


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