Remove tabs in README.txt

This commit is contained in:
Daniel 2013-03-12 11:02:08 +01:00
parent abd086917c
commit 214296d583
1 changed files with 44 additions and 44 deletions

View File

@ -14,63 +14,63 @@ interface from z3c.formwidget.query and have a search() method.
Example Usage::
from zope.component import adapts
from zope.interface import Interface, implements
from zope import schema
from zope.component import adapts
from zope.interface import Interface, implements
from zope import schema
from plone.z3cform import layout
from plone.z3cform import layout
from z3c.form import form, button, field
from z3c.form import form, button, field
from plone.formwidget.contenttree import ContentTreeFieldWidget
from plone.formwidget.contenttree import MultiContentTreeFieldWidget
from plone.formwidget.contenttree import PathSourceBinder
from plone.formwidget.contenttree import ContentTreeFieldWidget
from plone.formwidget.contenttree import MultiContentTreeFieldWidget
from plone.formwidget.contenttree import PathSourceBinder
class ITestForm(Interface):
class ITestForm(Interface):
buddy = schema.Choice(title=u"Buddy object",
description=u"Select one, please",
source=PathSourceBinder(portal_type='Document'))
buddy = schema.Choice(title=u"Buddy object",
description=u"Select one, please",
source=PathSourceBinder(portal_type='Document'))
friends = schema.List(
title=u"Friend objects",
description=u"Select as many as you want",
value_type=schema.Choice(
title=u"Selection",
source=PathSourceBinder(portal_type='Document')))
friends = schema.List(
title=u"Friend objects",
description=u"Select as many as you want",
value_type=schema.Choice(
title=u"Selection",
source=PathSourceBinder(portal_type='Document')))
class TestAdapter(object):
implements(ITestForm)
adapts(Interface)
class TestAdapter(object):
implements(ITestForm)
adapts(Interface)
def __init__(self, context):
self.context = context
def __init__(self, context):
self.context = context
def _get_buddy(self):
return None
def _set_buddy(self, value):
print "setting", value
buddy = property(_get_buddy, _set_buddy)
def _get_buddy(self):
return None
def _set_buddy(self, value):
print "setting", value
buddy = property(_get_buddy, _set_buddy)
def _get_friends(self):
return []
def _set_friends(self, value):
print "setting", value
friends = property(_get_friends, _set_friends)
def _get_friends(self):
return []
def _set_friends(self, value):
print "setting", value
friends = property(_get_friends, _set_friends)
class TestForm(form.Form):
fields = field.Fields(ITestForm)
fields['buddy'].widgetFactory = ContentTreeFieldWidget
fields['friends'].widgetFactory = MultiContentTreeFieldWidget
# To check display mode still works, uncomment this and hit refresh.
#mode = 'display'
class TestForm(form.Form):
fields = field.Fields(ITestForm)
fields['buddy'].widgetFactory = ContentTreeFieldWidget
fields['friends'].widgetFactory = MultiContentTreeFieldWidget
# To check display mode still works, uncomment this and hit refresh.
#mode = 'display'
@button.buttonAndHandler(u'Ok')
def handle_ok(self, action):
data, errors = self.extractData()
print data, errors
@button.buttonAndHandler(u'Ok')
def handle_ok(self, action):
data, errors = self.extractData()
print data, errors
TestView = layout.wrap_form(TestForm)
TestView = layout.wrap_form(TestForm)