code
stringlengths
1
1.72M
language
stringclasses
1 value
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, 4) 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
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 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' def makeForm(ctx): form = forms.Form() form.addField('required', forms.String(required=True)) form.addField('oneString', forms.String(), forms.widg...
Python
from nevow import url import forms title = 'Extra Button' description = 'Example of adding an extra, non-validating button' def makeForm(ctx): form = forms.Form() form.addField('aString', forms.String(required=True)) form.addAction(formSubmitted) form.addAction(redirect, 'back', validate=False) re...
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, 4) 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
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. """ 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 import implements f...
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 = '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 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', ] def makeSit...
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
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, 1, 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.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 processInput(self, ctx, key, args): pass clas...
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 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' 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, 2) 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
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 # 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 from nevow.i18n import _ from forms import converters, iforms, validation from forms.util import keytocssid from forms.form import widgetResourceUR...
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 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