code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
import formal
from formal.examples import main
class SmartUploadFormPage(main.FormExamplePage):
title = 'Smart File Upload'
description = 'Smart uploading of files where the file is "carried across" when the validation fails'
def form_example(self, ctx):
form = formal.Form()
form.addF... | Python |
import formal
from formal.examples import main
class GroupFormPage(main.FormExamplePage):
title = 'Field Group Form'
description = 'Groups of fields on a form'
def form_example(self, ctx):
def makeAddressGroup(name):
address = formal.Group(name)
address.add(formal... | Python |
import formal
from formal.examples import main
class HiddenFieldsFormPage(main.FormExamplePage):
title = 'Hidden Fields Form'
description = 'A form with a hidden field.'
def form_example(self, ctx):
form = formal.Form()
form.addField('hiddenString', formal.String(), widgetFactory=... | Python |
from datetime import datetime
import formal
from formal.examples import main
class PrepopulateFormPage(main.FormExamplePage):
title = 'Prepopulate'
description = 'Example of prepopulating form fields'
def form_example(self, ctx):
form = formal.Form()
form.addField('aString', formal.St... | Python |
import formal
from formal.examples import main
class DatesTimesFormPage(main.FormExamplePage):
title = 'Dates'
description = 'Date entry examples'
def form_example(self, ctx):
form = formal.Form()
form.addField('isoFormatDate', formal.Date(), formal.TextInput)
form.addField('m... | Python |
from twisted.internet import defer
from datetime import date
import formal
from formal.examples import main
# A boring list of (value, label) pairs.
strings = [
('foo', 'Foo'),
('bar', 'Bar'),
]
# A list of dates with meaningful names.
dates = [
(date(2005, 01, 01), 'New Year Day'),
(date(2005, 11... | Python |
import formal
from formal.examples import main
class NoFieldsFormPage(main.FormExamplePage):
title = 'Form With no Fields'
description = 'A form with no fields, just button(s). (Just to prove ' \
'it works.)'
def form_example(self, ctx):
form = formal.Form()
form.addAc... | Python |
import formal
from formal.examples import main
class RequiredFormPage(main.FormExamplePage):
title = 'Required Fields'
description = 'Demonstration of required fields'
def form_example(self, ctx):
form = formal.Form()
form.addField('name', formal.String(required=True))
form.addFie... | Python |
from zope.interface import Interface
class IType(Interface):
def validate(self, value):
pass
class IStructure(Interface):
pass
class IWidget(Interface):
def render(self, ctx, key, args, errors):
pass
def renderImmutable(self, ctx, key, args, errors):
pass
def process... | Python |
"""A package (for Nevow) for defining the schema, validation and rendering of
HTML forms.
"""
version_info = (0, 8, 2)
version = '.'.join([str(i) for i in version_info])
from nevow import static
from formal.types import *
from formal.validation import *
from formal.widget import *
from formal.widgets.restwidget imp... | Python |
from twisted.application import internet, service
from nevow import appserver
from formal.examples import main
application = service.Application('examples')
service = internet.TCPServer(8000, main.makeSite(application))
service.setServiceParent(application)
| Python |
from setuptools import setup, find_packages
setup(
name='formal',
version='0.8.2',
description='HTML forms framework for Nevow',
author='Matt Goodall',
author_email='matt@pollenation.net',
packages=find_packages(),
package_data={
'formal': ['formal.css', 'html/*', 'js/*'],
}... | Python |
from datetime import date, time
from twisted.application import internet, service
from nevow import appserver, compy, loaders, rend, static, tags as T
import formal
import os
from shutil import copyfileobj
import mimetypes, datetime
from formal import iformal, htmleditor, converters
from fileresource import fileResour... | Python |
import os
from shutil import copyfileobj
FILESTORE_DIR='assets'
FILESTORE_URL='webassets'
class fileResource:
def getUrlForFile(self, id):
if id:
return os.path.join(FILESTORE_URL, id)
else:
return None
def storeFile( self, source, name ):
id = name
... | Python |
from twisted.application import internet, service
from nevow import appserver
from forms.examples import main
application = service.Application('examples')
service = internet.TCPServer(8000, main.makeSite(application))
service.setServiceParent(application)
| Python |
from setuptools import setup, find_packages
import forms
setup(
name='forms',
version=forms.version,
description='HTML forms framework for Nevow',
author='Matt Goodall',
author_email='matt@pollenation.net',
packages=find_packages(),
package_data={
'forms': ['forms.css', 'html/*', '... | Python |
from datetime import date, time
from twisted.application import internet, service
from nevow import appserver, compy, loaders, rend, static, tags as T
import forms
import os
from shutil import copyfileobj
import mimetypes, datetime
from forms import iforms, htmleditor, converters
from fileresource import fileResource
... | Python |
import os
from shutil import copyfileobj
FILESTORE_DIR='assets'
FILESTORE_URL='webassets'
class fileResource:
def getUrlForFile(self, id):
if id:
return os.path.join(FILESTORE_URL, id)
else:
return None
def storeFile( self, source, name ):
id = name
... | Python |
"""
Form types.
"""
from forms import iforms, validation
from zope.interface import implements
class Type(object):
implements( iforms.IType )
# Name of the instance
name = None
# Value to use if no value entered
missing = None
# Instance cannot be changed
immutable = False
# List of... | Python |
"""
Form implementation and high-level renderers.
"""
from twisted.internet import defer
from nevow import appserver, context, loaders, inevow, tags as T, url
from nevow.compy import registerAdapter, Interface
from nevow.util import getPOSTCharset
from forms import iforms, util, validation
from resourcemanager import ... | Python |
from nevow import tags as T, util
from forms import iforms
from zope.interface import implements
tinyMCEGlue = T.xml("""
<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
... | Python |
from nevow import appserver, rend
from forms.form import FormsResourceBehaviour
class FormPage(rend.Page):
"""
Base class for pages that contain a Form.
XXX This really, really needs to turn into a ComponentPage that iterates
a bunch of component behaviours looking for something that succeeded.
... | Python |
import tempfile
import mimetypes
import re
import os
from shutil import copyfileobj
from exceptions import IOError, OSError
class ResourceManagerException( Exception ):
def __init__( self, *args, **kwds ):
super( ResourceManagerException, self ).__init__( *args, **kwds )
class ResourceManager( object ):
... | Python |
"""
ReST text area widget.
"""
from nevow import inevow, loaders, rend, tags as T
from forms import iforms, widget
from forms.util import keytocssid
from forms.form import widgetResourceURLFromContext
class ReSTTextArea(widget.TextArea):
"""
A large text entry area that accepts ReST and previews it as HTML
... | Python |
"""Adapters for converting to and from a type's value according to an
IConvertible protocol.
"""
from datetime import date, time
from nevow.compy import Adapter
from forms import iforms, validation
from zope.interface import implements
class NullConverter(Adapter):
implements( iforms.IStringConvertible )
... | Python |
from zope.interface import implements
from nevow import inevow
from forms import iforms
def titleFromName(name):
def _():
it = iter(name)
last = None
while 1:
ch = it.next()
if ch == '_':
if last != '_':
yield ' '
e... | Python |
"""
Widgets are small components that render form fields for inputing data in a
certain format.
"""
import itertools
import pkg_resources
from nevow import inevow, loaders, tags as T, util, url, static, rend
from nevow.i18n import _
from forms import converters, iforms, validation
from forms.util import keytocssid
fro... | Python |
import re
from zope.interface import implements
from forms import iforms
class FormsError(Exception):
"""
Base class for all Forms errors. A single string, message, is accepted and
stored as an attribute.
The message is not passed on to the Exception base class because it doesn't
seem to be a... | Python |
from nevow import url
import forms
from forms.examples import main
class ActionButtonsPage(main.FormExamplePage):
title = 'Action Button'
description = 'Example of non-validating button, buttons with non-default labels, etc'
def form_example(self, ctx):
form = forms.Form()
form.addFie... | Python |
import forms
from forms.examples import main
# Let the examples run if docutils is not installed
try:
import docutils
except ImportError:
import warnings
warnings.warn("docutils is not installed")
docutilsAvailable = False
else:
docutilsAvailable = True
if docutilsAvailable:
from docutils.wr... | Python |
from zope.interface import implements
import forms
from forms import iforms
from forms.examples import main
# A not-too-good regex for matching an IP address.
IP_ADDRESS_PATTERN = '^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'
class ValidatorFormPage(main.FormExamplePage):
title = 'Custom form validation'
descri... | Python |
import forms
from forms.examples import main
class SimpleFormPage(main.FormExamplePage):
title = 'Simple Form'
description = 'Probably the simplest form possible.'
def form_example(self, ctx):
form = forms.Form()
form.addField('aString', forms.String())
form.addAction(self... | Python |
import forms
from forms.examples import main
class TypesFormPage(main.FormExamplePage):
title = 'Form Types'
description = 'Example of using different typed fields.'
def form_example(self, ctx):
form = forms.Form()
form.addField('aString', forms.String())
form.addField('aInteger',... | Python |
from datetime import date
import forms
from forms.examples import main
class MissingFormPage(main.FormExamplePage):
title = 'Missing Values'
description = 'Providing default values when missing'
def form_example(self, ctx):
form = forms.Form()
form.addField('aString', forms.String(mis... | Python |
import forms
from forms.examples import main
class FileUploadFormPage(main.FormExamplePage):
title = 'File Upload'
description = 'Uploading a file'
def form_example(self, ctx):
form = forms.Form()
form.addField('file', forms.File())
form.addAction(self.submitted)
retur... | Python |
import pkg_resources
from zope.interface import implements
from twisted.python import reflect
from nevow import appserver, inevow, loaders, rend, static, tags as T, url
import forms
DOCTYPE = T.xml('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">')
CHARSET ... | Python |
import forms
from forms.examples import main
class SmartUploadFormPage(main.FormExamplePage):
title = 'Smart File Upload'
description = 'Smart uploading of files where the file is "carried across" when the validation fails'
def form_example(self, ctx):
form = forms.Form()
form.addFiel... | Python |
from datetime import datetime
import forms
from forms.examples import main
class PrepopulateFormPage(main.FormExamplePage):
title = 'Prepopulate'
description = 'Example of prepopulating form fields'
def form_example(self, ctx):
form = forms.Form()
form.addField('aString', forms.String... | Python |
import forms
from forms.examples import main
class DatesTimesFormPage(main.FormExamplePage):
title = 'Dates'
description = 'Date entry examples'
def form_example(self, ctx):
form = forms.Form()
form.addField('isoFormatDate', forms.Date(), forms.TextInput)
form.addField('monthF... | Python |
from twisted.internet import defer
from datetime import date
import forms
from forms.examples import main
# A boring list of (value, label) pairs.
strings = [
('foo', 'Foo'),
('bar', 'Bar'),
]
# A list of dates with meaningful names.
dates = [
(date(2005, 01, 01), 'New Year Day'),
(date(2005, 11, ... | Python |
import forms
from forms.examples import main
class RequiredFormPage(main.FormExamplePage):
title = 'Required Fields'
description = 'Demonstration of required fields'
def form_example(self, ctx):
form = forms.Form()
form.addField('name', forms.String(required=True))
form.addField('... | Python |
"""A package (for Nevow) for defining the schema, validation and rendering of
HTML forms.
"""
version_info = (0, 6, 0)
version = '.'.join([str(i) for i in version_info])
from nevow import static
from forms.types import *
from forms.validation import *
from forms.widget import *
from forms.widgets.restwidget import ... | Python |
from nevow.compy import Interface
class IType(Interface):
def validate(self, value):
pass
class IStructure(Interface):
pass
class IWidget(Interface):
def render(self, ctx, key, args, errors):
pass
def renderImmutable(self, ctx, key, args, errors):
pass
def processInp... | Python |
from twisted.application import internet, service
from nevow import appserver
from forms.examples import main
application = service.Application('examples')
service = internet.TCPServer(8000, main.makeSite(application))
service.setServiceParent(application)
| Python |
from setuptools import setup, find_packages
import forms
setup(
name='forms',
version=forms.version,
description='HTML forms framework for Nevow',
author='Matt Goodall',
author_email='matt@pollenation.net',
packages=find_packages(),
package_data={
'forms': ['forms.css'],
}
... | Python |
from datetime import date, time
from twisted.application import internet, service
from nevow import appserver, compy, loaders, rend, static, tags as T
import forms
import os
from shutil import copyfileobj
import mimetypes, datetime
from forms import iforms, htmleditor, converters
from fileresource import fileResource
... | Python |
import os
from shutil import copyfileobj
FILESTORE_DIR='assets'
FILESTORE_URL='webassets'
class fileResource:
def getUrlForFile(self, id):
if id:
return os.path.join(FILESTORE_URL, id)
else:
return None
def storeFile( self, source, name ):
id = name
... | Python |
"""
Form types.
"""
from forms import iforms, validation
from zope.interface import implements
class Type(object):
implements( iforms.IType )
# Name of the instance
name = None
# Instance is required
required = False
# Value to use if no value entered
missing = None
# Instance canno... | Python |
"""
Form implementation and high-level renderers.
"""
from twisted.internet import defer
from nevow import context, loaders, inevow, tags as T, url
from nevow.compy import registerAdapter, Interface
from forms import iforms, util, validation
from resourcemanager import ResourceManager
from zope.interface import implem... | Python |
from nevow import tags as T, util
from forms import iforms
from zope.interface import implements
tinyMCEGlue = T.xml("""
<!-- tinyMCE -->
<script language="javascript" type="text/javascript" src="/tiny_mce/tiny_mce.js"></script>
<script language="javascript" type="text/javascript">
tinyMCE.init({
... | Python |
import tempfile
import mimetypes
import re
import os
from shutil import copyfileobj
from exceptions import IOError, OSError
class ResourceManagerException( Exception ):
def __init__( self, *args, **kwds ):
super( ResourceManagerException, self ).__init__( *args, **kwds )
class ResourceManager( object ):
... | Python |
"""Adapters for converting to and from a type's value according to an
IConvertible protocol.
"""
from datetime import date, time
from nevow.compy import Adapter
from forms import iforms, validation
from zope.interface import implements
class NullConverter(Adapter):
implements( iforms.IStringConvertible )
... | Python |
from forms import iforms
from zope.interface import implements
def titleFromName(name):
def _():
it = iter(name)
last = None
while 1:
ch = it.next()
if ch == '_':
if last != '_':
yield ' '
elif last in (None,'_'):
... | Python |
"""
Widgets are small components that render form fields for inputing data in a
certain format.
"""
import itertools
from nevow import inevow, tags as T, util, url, static
from forms import converters, iforms, validation
from forms.util import keytocssid
from forms.form import formWidgetResource
from zope.interface im... | Python |
import re
from zope.interface import implements
from forms import iforms
class FormError(Exception):
pass
class FieldError(Exception):
def __init__(self, message, fieldName=None):
Exception.__init__(self, message)
self.message = message
self.fieldName = fieldName
cl... | Python |
import forms
title = 'Dates'
description = 'Date entry examples'
def makeForm(ctx):
form = forms.Form()
form.addField('isoFormat', forms.Date(), forms.TextInput)
form.addField('monthFirst', forms.Date(), forms.DatePartsInput)
form.addField('dayFirst', forms.Date(), forms.widgetFactory(forms.DatePartsI... | Python |
import forms
title = 'Simple Form'
description = 'Probably the simplest form possible.'
def makeForm(ctx):
form = forms.Form()
form.addField('aString', forms.String())
form.addAction(formSubmitted)
return form
def formSubmitted(ctx, form, data):
print form, data
| Python |
import forms
title = 'Form Types'
description = 'Example of using different typed fields.'
def makeForm(ctx):
form = forms.Form()
form.addField('aString', forms.String())
form.addField('aInteger', forms.Integer())
form.addField('aFloat', forms.Float())
form.addField('aBoolean', forms.Boolean())
... | Python |
from datetime import date
import forms
title = 'Missing Values'
description = 'Providing default values when missing'
def makeForm(ctx):
form = forms.Form()
form.addField('aString', forms.String(missing='<nothing>'))
form.addField('aDate', forms.Date(missing=date(2005, 8, 1)))
form.addAction(formSubmi... | Python |
import forms
title = 'File Upload'
description = 'Uploading a file'
def makeForm(ctx):
form = forms.Form()
form.addField('file', forms.File())
form.addAction(formSubmitted)
return form
def formSubmitted(ctx, form, data):
print form, data
| Python |
import pkg_resources
from twisted.python import reflect
from nevow import appserver, loaders, rend, static, tags as T, url
import forms
examples = [
'forms.examples.simple',
'forms.examples.types',
'forms.examples.required',
'forms.examples.missing',
'forms.examples.prepopulate',
'forms.example... | Python |
import forms
title = 'Smart File Upload'
description = 'Smart uploading of files where the file is "carried across" when the validation fails'
def makeForm(ctx):
form = forms.Form()
form.addField('required', forms.String(required=True))
form.addField('file', forms.File(), forms.FileUploadWidget)
form.... | Python |
from datetime import datetime
import forms
title = 'Prepopulate'
description = 'Example of prepopulating form fields'
def makeForm(ctx):
form = forms.Form()
form.addField('aString', forms.String())
form.addField('aTime', forms.Time())
form.addAction(formSubmitted)
form.data = {
'aTime': da... | Python |
from twisted.internet import defer
from datetime import date
import forms
title = 'Selection widgets'
description = 'Example of the various selection widgets'
def makeForm(ctx):
form = forms.Form()
form.addField('required', forms.String(required=True))
form.addField('oneString', forms.String(), forms.widg... | Python |
import forms
title = 'Required Fields'
description = 'Demonstration of required fields'
def makeForm(ctx):
form = forms.Form()
form.addField('name', forms.String(required=True))
form.addField('age', forms.Integer())
form.addAction(formSubmitted)
return form
def formSubmitted(ctx, form, data):
... | Python |
"""A package (for Nevow) for defining the schema, validation and rendering of
HTML forms.
"""
version_info = (0, 2, 1)
version = '.'.join([str(i) for i in version_info])
from nevow import static
from forms.types import *
from forms.validation import *
from forms.widget import *
from forms.form import Form, Resourc... | Python |
from nevow.compy import Interface
class IType(Interface):
def validate(self, value):
pass
class IStructure(Interface):
pass
class IWidget(Interface):
def render(self, ctx, key, args, errors):
pass
def renderImmutable(self, ctx, key, args, errors):
... | Python |
"""
Form types.
"""
try:
import decimal
haveDecimal = True
except ImportError:
haveDecimal = False
from zope.interface import implements
from formal import iformal, validation
class Type(object):
implements( iformal.IType )
# Name of the instance
name = None
# Value to use if no value ... | Python |
"""
Form implementation and high-level renderers.
"""
from zope.interface import Interface
from twisted.internet import defer
from twisted.python.components import registerAdapter
from nevow import appserver, context, loaders, inevow, rend, tags as T, url
from nevow.util import getPOSTCharset
from formal import iforma... | Python |
import warnings
warnings.warn(
"The htmleditor module is deprecated. To use an HTML editor with " \
"formal, render your field as a formal.TextArea and use JavaScript " \
"to turn the textarea into a HTML editor.",
DeprecationWarning,
stacklevel=2)
from nevow import tags as T, ... | Python |
from nevow import appserver, rend
from formal.form import FormsResourceBehaviour
class FormPage(rend.Page):
"""
Base class for pages that contain a Form.
XXX This really, really needs to turn into a ComponentPage that iterates
a bunch of component behaviours looking for something that succeeded.
... | Python |
import base64
import tempfile
import mimetypes
import re
import os
from shutil import copyfileobj
from exceptions import IOError, OSError
# Use Python 2.4 base64 API if possible. Simulate on Python 2.3.
try:
base64.b64encode
except AttributeError:
# Python 2.3
def base64encode(s):
return base64.en... | Python |
__all__ = ['CompositeWidget']
from zope.interface import implements
from nevow import tags as T
import formal.iformal, formal.util
#####
# TODO:
# * composition labels, and position (?)
# * composition widgets
# * composition errors (?)
# * composition description (?)
# * Validate XHTML
class CompositeWidg... | Python |
"""
ReST text area widget.
"""
from nevow import inevow, loaders, rend, tags as T
from formal import iformal, widget
from formal.util import render_cssid
from formal.form import widgetResourceURLFromContext
class ReSTTextArea(widget.TextArea):
"""
A large text entry area that accepts ReST and previews it as ... | Python |
from zope.interface import implements
from nevow import tags as T
from formal import iformal
from formal.util import render_cssid
_UNSET = object()
class MultichoiceBase(object):
"""
A base class for widgets that provide the UI to select one or more items
from a list.
Based on ChoiceBase
options... | Python |
"""Adapters for converting to and from a type's value according to an
IConvertible protocol.
"""
from datetime import date, time
try:
import decimal
haveDecimal = True
except ImportError:
haveDecimal = False
from formal import iformal, validation
from zope.interface import implements
class _Adapter(objec... | Python |
import re
from zope.interface import implements
from nevow import inevow, tags
from formal import iformal
_IDENTIFIER_REGEX = re.compile('^[a-zA-Z_][a-zA-Z0-9_]*$')
def titleFromName(name):
def _():
it = iter(name)
last = None
while 1:
ch = it.next()
if ch == '... | Python |
"""
Widgets are small components that render form fields for inputing data in a
certain format.
"""
import itertools
from nevow import inevow, loaders, tags as T, util, url, static, rend
from nevow.i18n import _
from formal import converters, iformal, validation
from formal.util import render_cssid
from formal.form im... | Python |
import re
from zope.interface import implements
from formal import iformal
class FormsError(Exception):
"""
Base class for all Forms errors. A single string, message, is accepted and
stored as an attribute.
The message is not passed on to the Exception base class because it doesn't
seem to be... | Python |
from nevow import url
import formal
from formal.examples import main
class ActionButtonsPage(main.FormExamplePage):
title = 'Action Button'
description = 'Example of non-validating button, buttons with non-default labels, etc'
def form_example(self, ctx):
form = formal.Form()
form.add... | Python |
import formal
from formal.examples import main
class CompositeFormPage(main.FormExamplePage):
title = 'Composite fields'
description = 'Form containing composite fields'
def form_example(self, ctx):
# Create the form
form = formal.Form()
# Add a required name where the... | Python |
import formal
from formal.examples import main
# Let the examples run if docutils is not installed
try:
import docutils
except ImportError:
import warnings
warnings.warn("docutils is not installed")
docutilsAvailable = False
else:
docutilsAvailable = True
if docutilsAvailable:
from docutils.... | Python |
from zope.interface import implements
import formal
from formal import iformal
from formal.examples import main
# A not-too-good regex for matching an IP address.
IP_ADDRESS_PATTERN = '^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$'
class ValidatorFormPage(main.FormExamplePage):
title = 'Custom form validation'
de... | Python |
import formal
from formal.examples import main
class SimpleFormPage(main.FormExamplePage):
title = 'Simple Form'
description = 'Probably the simplest form possible.'
def form_example(self, ctx):
form = formal.Form()
form.addField('aString', formal.String())
form.addAction(... | Python |
try:
import decimal
haveDecimal = True
except ImportError:
haveDecimal = False
import formal
from formal.examples import main
class TypesFormPage(main.FormExamplePage):
title = 'Form Types'
description = 'Example of using different typed fields.'
def form_example(self, ctx):
form = fo... | Python |
from datetime import date
import formal
from formal.examples import main
class MissingFormPage(main.FormExamplePage):
title = 'Missing Values'
description = 'Providing default values when missing'
def form_example(self, ctx):
form = formal.Form()
form.addField('aString', formal.String... | Python |
import formal
from formal.examples import main
class FileUploadFormPage(main.FormExamplePage):
title = 'File Upload'
description = 'Uploading a file'
def form_example(self, ctx):
form = formal.Form()
form.addField('file', formal.File())
form.addAction(self.submitted)
r... | Python |
import pkg_resources
from zope.interface import implements
from twisted.python import reflect
from nevow import appserver, inevow, loaders, rend, static, tags as T, url
import formal
DOCTYPE = T.xml('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">')
CHARSET... | Python |
import formal
from formal.examples import main
class SmartUploadFormPage(main.FormExamplePage):
title = 'Smart File Upload'
description = 'Smart uploading of files where the file is "carried across" when the validation fails'
def form_example(self, ctx):
form = formal.Form()
form.addF... | Python |
import formal
from formal.examples import main
class GroupFormPage(main.FormExamplePage):
title = 'Field Group Form'
description = 'Groups of fields on a form'
def form_example(self, ctx):
def makeAddressGroup(name):
address = formal.Group(name)
address.add(formal... | Python |
import formal
from formal.examples import main
class HiddenFieldsFormPage(main.FormExamplePage):
title = 'Hidden Fields Form'
description = 'A form with a hidden field.'
def form_example(self, ctx):
form = formal.Form()
form.addField('hiddenString', formal.String(), widgetFactory=... | Python |
from datetime import datetime
import formal
from formal.examples import main
class PrepopulateFormPage(main.FormExamplePage):
title = 'Prepopulate'
description = 'Example of prepopulating form fields'
def form_example(self, ctx):
form = formal.Form()
form.addField('aString', formal.St... | Python |
import formal
from formal.examples import main
class DatesTimesFormPage(main.FormExamplePage):
title = 'Dates'
description = 'Date entry examples'
def form_example(self, ctx):
form = formal.Form()
form.addField('isoFormatDate', formal.Date(), formal.TextInput)
form.addField('m... | Python |
from twisted.internet import defer
from datetime import date
import formal
from formal.examples import main
# A boring list of (value, label) pairs.
strings = [
('foo', 'Foo'),
('bar', 'Bar'),
]
# A list of dates with meaningful names.
dates = [
(date(2005, 01, 01), 'New Year Day'),
(date(2005, 11... | Python |
import formal
from formal.examples import main
class NoFieldsFormPage(main.FormExamplePage):
title = 'Form With no Fields'
description = 'A form with no fields, just button(s). (Just to prove ' \
'it works.)'
def form_example(self, ctx):
form = formal.Form()
form.addAc... | Python |
import formal
from formal.examples import main
class RequiredFormPage(main.FormExamplePage):
title = 'Required Fields'
description = 'Demonstration of required fields'
def form_example(self, ctx):
form = formal.Form()
form.addField('name', formal.String(required=True))
form.addFie... | Python |
from zope.interface import Interface
class IType(Interface):
def validate(self, value):
pass
class IStructure(Interface):
pass
class IWidget(Interface):
def render(self, ctx, key, args, errors):
pass
def renderImmutable(self, ctx, key, args, errors):
pass
def process... | Python |
"""A package (for Nevow) for defining the schema, validation and rendering of
HTML forms.
"""
version_info = (0, 9, 0)
version = '.'.join([str(i) for i in version_info])
from nevow import static
from formal.types import *
from formal.validation import *
from formal.widget import *
from formal.widgets.composite impo... | Python |
from twisted.application import internet, service
from nevow import appserver
from formal.examples import main
application = service.Application('examples')
service = internet.TCPServer(8000, main.makeSite(application))
service.setServiceParent(application)
| Python |
from setuptools import setup, find_packages
setup(
name='formal',
version='0.9',
description='HTML forms framework for Nevow',
author='Matt Goodall',
author_email='matt@pollenation.net',
packages=find_packages(),
package_data={
'': ['*.css', '*.html', '*.js'],
},
zip_saf... | Python |
Subsets and Splits
SQL Console for ajibawa-2023/Python-Code-Large
Provides a useful breakdown of language distribution in the training data, showing which languages have the most samples and helping identify potential imbalances across different language groups.