本文整理汇总了Python中ptah.cms.forms.AddForm.name_show方法的典型用法代码示例。如果您正苦于以下问题:Python AddForm.name_show方法的具体用法?Python AddForm.name_show怎么用?Python AddForm.name_show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ptah.cms.forms.AddForm
的用法示例。
在下文中一共展示了AddForm.name_show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_addform_no_name_widgets
# 需要导入模块: from ptah.cms.forms import AddForm [as 别名]
# 或者: from ptah.cms.forms.AddForm import name_show [as 别名]
def test_addform_no_name_widgets(self):
from ptah.cms.forms import AddForm
form = AddForm(Container(), DummyRequest())
Content.__type__.permission = ptah.cms.NO_PERMISSION_REQUIRED
form.tinfo = Content.__type__
form.name_show = False
form.update()
self.assertIsNone(form.name_widgets)
示例2: test_addform_extract_with_errors_no_name
# 需要导入模块: from ptah.cms.forms import AddForm [as 别名]
# 或者: from ptah.cms.forms.AddForm import name_show [as 别名]
def test_addform_extract_with_errors_no_name(self):
from ptah.cms.forms import AddForm
form = AddForm(Container(), DummyRequest(
POST={'__name__': 't/est-content'}))
Content.__type__.permission = ptah.cms.NO_PERMISSION_REQUIRED
form.tinfo = Content.__type__
form.name_show = False
form.update()
data, errors = form.extract()
self.assertEqual(len(errors), 1)
self.assertEqual(errors[0].field.name, 'title')
self.assertEqual(errors[0].msg, 'Required')
示例3: test_addform_extract_no_name
# 需要导入模块: from ptah.cms.forms import AddForm [as 别名]
# 或者: from ptah.cms.forms.AddForm import name_show [as 别名]
def test_addform_extract_no_name(self):
from ptah.cms.forms import AddForm
form = AddForm(Container(), DummyRequest(
POST={'title': 'Test Content',
'__name__': 'test-content'}))
Content.__type__.permission = ptah.cms.NO_PERMISSION_REQUIRED
form.tinfo = Content.__type__
form.name_show = False
form.update()
data, errors = form.extract()
self.assertEqual(len(errors), 0)
self.assertEqual(len(data), 2)
self.assertIn('title', data)
self.assertIn('description', data)