demo page added.
svn path=/plone.formwidget.captcha/trunk/; revision=28635
This commit is contained in:
parent
5dc1728306
commit
38fb57ef08
|
@ -40,7 +40,11 @@
|
|||
provides="Products.GenericSetup.interfaces.EXTENSION"
|
||||
/>
|
||||
|
||||
<!-- Demo view for testing -->
|
||||
<!-- <include file="demo.zcml" /> -->
|
||||
<!--
|
||||
example:
|
||||
http://yourplonesite/@@captcha_form
|
||||
-->
|
||||
|
||||
</configure>
|
||||
<include package=".demo" />
|
||||
|
||||
</configure>
|
|
@ -0,0 +1,17 @@
|
|||
<configure
|
||||
xmlns="http://namespaces.zope.org/zope"
|
||||
xmlns:browser="http://namespaces.zope.org/browser"
|
||||
i18n_domain="plone.formwidget.captcha">
|
||||
|
||||
<browser:page
|
||||
name="captcha_form"
|
||||
for="Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot"
|
||||
class=".form.CaptchaForm"
|
||||
permission = "zope.Public" />
|
||||
|
||||
<adapter
|
||||
for="Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot"
|
||||
provides=".form.ICaptchaForm"
|
||||
factory=".form.Captcha" />
|
||||
|
||||
</configure>
|
|
@ -0,0 +1,27 @@
|
|||
from zope import interface
|
||||
from z3c.form import form, field, button
|
||||
from zope import schema
|
||||
from plone.z3cform.layout import wrap_form
|
||||
from plone.formwidget.captcha.widget import CaptchaFieldWidget
|
||||
|
||||
class ICaptchaForm(interface.Interface):
|
||||
captcha = schema.TextLine(title=u"Captcha",
|
||||
description=u"",
|
||||
required=False)
|
||||
|
||||
class Captcha(object):
|
||||
captcha = ''
|
||||
def __init__(self, context):
|
||||
self.context = context
|
||||
|
||||
class BaseForm(form.Form):
|
||||
""" example captcha form """
|
||||
fields = field.Fields(ICaptchaForm)
|
||||
fields['captcha'].widgetFactory = CaptchaFieldWidget
|
||||
|
||||
@button.buttonAndHandler(u'Save')
|
||||
def handleApply(self, action):
|
||||
data, errors = self.extractData()
|
||||
return
|
||||
|
||||
CaptchaForm = wrap_form(BaseForm)
|
Reference in New Issue