code stringlengths 1 1.72M | language stringclasses 1
value |
|---|---|
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-rest',
version=forms.version,
description='HTML forms framework for Nevow, branch with ReST control',
author='Matt Goodall',
author_email='matt@pollenation.net',
packages=find_packages(),
package_data={
'fo... | 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 |
"""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
from nevow import inevow, tags as T, util, url, static, rend, loaders
from nevow.i18n import _
from forms import converters, iforms, validation
from forms.util import keytocssid
from forms.form import w... | 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 |
from nevow import url
import forms
title = 'Action Button'
description = 'Example of non-validating button, buttons with non-default labels, etc'
def makeForm(ctx):
form = forms.Form()
form.addField('aString', forms.String(required=True))
form.addAction(formSubmitted, label="Click, click, clickety-click!"... | Python |
import forms
from docutils.writers.html4css1 import Writer, HTMLTranslator
from docutils import nodes
title = 'ReST widget'
description = 'The ReST widget captures ReST and previews as HTML.'
class CustomisedHTMLTranslator(HTMLTranslator):
def visit_newdirective_node(self, node):
self.body.append('<div>S... | 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
DOCTYPE = T.xml('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">')
CHARSET = T.xml('<meta http-equiv="content-type" conte... | 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'
differentNone = ('none value', '- select -')
def makeForm(ctx):
form = forms.Form()
form.addField('required', forms.String(required=True))
form.ad... | 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, 3, 6)
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, Resource... | 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 |
"""
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 |
"""
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 |
from zope.interface import implements
from nevow import tags as T, util
from formal import iformal
from formal.util import render_cssid
class TextAreaWithSelect(object):
"""
A large text entry area that accepts newline characters.
<textarea>...</textarea>
"""
implements( iformal.IWidget )
co... | 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
# 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('d... | 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 |
from formal import Field, Form, Group, String
from formal.examples import main
class StanStyleFormPage(main.FormExamplePage):
title = 'Stan-Style Form'
description = 'Building a Form in a stan style'
def form_example(self, ctx):
form = Form()[
Group("me")[
Fiel... | Python |
import formal
from formal.examples import main
from formal.widgets.textareawithselect import TextAreaWithSelect
class TextAreaWithSelectFormPage(main.FormExamplePage):
title = 'Text area with select'
description = 'text area with a select box to append new info'
def form_example(self, ctx):
... | 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, 11, 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.restwidget im... | 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())
service.setServiceParent(application)
| Python |
from setuptools import setup, find_packages
setup(
name='formal',
version='0.11.0',
description='HTML forms framework for Nevow',
author='Matt Goodall',
author_email='matt@pollenation.net',
packages=find_packages(),
include_package_data=True,
zip_safe = True,
)
| 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 |
from zope.interface import implements
from nevow import tags as T
from forms import iforms
from forms.util import keytocssid
_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
from nevow.compy import Adapter
from forms import iforms, validation
from zope.interface import implements
class NullConverter(Adapter):
implements( iforms.IStringConvertible )
... | Python |
import re
from zope.interface import implements
from nevow import inevow
from forms import iforms
_IDENTIFIER_REGEX = re.compile('^[a-zA-Z_][a-zA-Z0-9_]*$')
def titleFromName(name):
def gen():
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 forms import converters, iforms, validation
from forms.util import keytocssid
from forms.form import w... | 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 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 = forms.Form()
form.addActio... | 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, 7, 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 |
"""
Form types.
"""
try:
import decimal
haveDecimal = True
except ImportError:
haveDecimal = False
from zope.interface import implements
from twisted.internet import defer
from formal import iformal, validation
class Type(object):
implements( iformal.IType )
# Name of the instance
name = N... | Python |
"""
Form implementation and high-level renderers.
"""
from zope.interface import Interface
from twisted.internet import defer
from twisted.internet import reactor
from twisted.python.components import registerAdapter
from nevow import appserver, context, loaders, inevow, rend, tags as T, url
from nevow.util import get... | 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 |
"""
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 |
"""
Rich text area widget.
"""
from nevow import inevow, loaders, rend, tags as T, util
from formal import iformal, widget, types
from formal.util import render_cssid
from zope.interface import Interface
class RichTextArea(widget.TextArea):
"""
A large text entry area that can be used for different formats of... | 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 |
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.