Package: yafowil
yafowilYet Another Form WIdget LibraryYAFOWIL offers html-form creation and modification at runtime.
It is light-weight and provides an extensible, reusable set of blueprints to build flexible forms.YAFOWIL is independent from any web-framework, but easy to use in your web-framework.It’s all just about rendering widgets and extracting the data returned from the browser per widget.
It does not fight with storage.YAFOWIL vary from most other HTML form packages: Its all just configuration.
No subclassing needed any more; no specific schema-framework is necessary.Yafowil provides a factory where you can fetch your widgets instances from.
Or you register your own.Detailed DocumentationIf you’re interested to dig deeper: i
Thedetailed YAFOWIL documentationis available.
Read it and learn how to create your example application with YAFOWIL forms in 15 minutes.Source CodeThe sources are in a GIT DVCS with its main branches atgithub.We’d be happy to see many forks and pull-requests to make YAFOWIL even better.ContributorsJens W. KleinRobert NiederreiterJohannes RaggamPeter HolzerAttila OlahFlorian FriesdorfDaniel WiderinGeorg BernhardChristian Scholz aka MrTopfHistory3.1.0 (2023-05-15)Refactor datatype conversion. Datatype related extractors and utils are
contained inyafowil.datatypenow. Fix datatype conversion forbytestype.
[rnix]Split upyafowil.commonmodule [rnix]Movebuttonandsubmitblueprints toyafowil.button.Movecheckboxblueprint toyafowil.checkbox.Moveemailblueprint toyafowil.email.Movefield,label,helpanderrorblueprints toyafowil.field.Movefileblueprint toyafowil.file.Movehiddenblueprint toyafowil.hidden.Movelinesblueprint toyafowil.lines.Movenumberblueprint toyafowil.number.Movepasswordblueprint toyafowil.password.Moveproxyblueprint toyafowil.proxy.Movesearchblueprint toyafowil.search.Moveselectblueprint toyafowil.select.Movetagblueprint toyafowil.tag.Movetextblueprint toyafowil.text.Movetextareablueprint toyafowil.textarea.Moveurlblueprint toyafowil.url.Tests work with pytest.
[rnix]3.0.1 (2022-12-05)File extractor raises anExtractionErrorif file action isreplacebut no file is uploaded instead of silently changing the action tokeep.
[rnix]Documentvocabularyproperty offileblueprint.
[rnix]Addyafowil.common.mimetype_extractorand use infileblueprint.
[rnix]Add runtime data path to error message if persist writer not found.
[rnix]3.0 (2022-10-06)Python 3.7+ support.
[rnix, jensens]Try to translate plain error message inerror_rendererin case of nomessage_tagdefined.
[jensens]Addvalid_classandvalid_class_defaultas opposite oferror_classanderror_class_defaultto mark extracted values as valid.
[jensens]Addbuttonblueprint.
[jensens]Internals:Remove usage ofNodespacesbehavior.
[rnix]Replace deprecated use ofNodifybyMappingNode.
[rnix]Replace deprecated use ofNodeChildValidatebyMappingConstraints.
[rnix]Replace deprecated use ofAdoptbyMappingAdopt.
[rnix]RemoveNodeChildValidateandAdoptbehaviors fromWidgetAttributes.
[rnix]Addpush_stateandpop_stateto factory. Used inYafowilTestCasefor saving and restoring factory state. This is needed when yafowil tests run
in compound with foreign tests to avoid breaking possible custom factory
configuration.
[rnix]Breaking changes:Remove B/C behavior ofcallable_valuefunction. No longer calls callable
without parameters as fallback. Always expect widget and data arguments in
signature.
[jensens]datatypeconverters now always gets passed the raw extracted value only.
Prior to removing B/C behavior fromcallable_valueit was possible to use
callables taking widget and data as arguments returning the real converter
callable. This behavior was never intended to be supported for datatype
conversion.
[jensens]2.3.4 (2021-11-08)Rename deprecatedWidgetAttributes.allow_non_node_childstoallow_non_node_children.
[rnix]2.3.3 (2020-05-30)Ensureselecttag not renders without closing tag if no options.
[rnix]2.3.2 (2019-11-07)Refactor yafowil plugin lookup. Improves performance.
[rnix, jensens]Uselogger.warninginstead of deprecatedlogger.warn.
[rnix]Addyafowil.utils.callable_value.
[rnix]Fixyafowil.utils.cssidto return unicode in order to prevent malformed
rendering in python 3.
[rnix]2.3.1 (2018-11-07)Do not dump string values as JSON data inyafowil.utils.as_data_attrs.
[rnix]Renameyafowil.utils.generic_html5_attrstoyafowil.utils.as_data_attrs.
[rnix]2.3 (2018-07-16)Python 3 Compatibility.
[rnix]Convert doctests to unittests.
[rnix]Cache results ofyafowil.utils.get_plugin_namesby namespace.
[rnix]Introduceyafowil.base.Factory.clearfunction. Used in tests to prepareyafowil.base.factorysingleton as required.
[rnix]Create deepcopy of resources inYafowilResources.__init__to prevent
modification of the original resource definitions.
[rnix]ImplementExtractionError.__eq__to make them comparable.
[rnix]Do not access deprecatedException.messageany more incommon.error_renderer. Addmsgattribute toExtractionErrordirectly and use this one to keep error translating sane.
[rnix]Add html5 data attribute support toform_edit_renderer.
[rnix]2.2.4 (2017-11-13)Do not setpersistproperty forproxyblueprint in factory defaults.
[rnix]Translate datatype label used to generate extraction error ingeneric_datatype_extractorif datatype conversion fails.
[rnix]Addgeneric_datatype_extractortoemailblueprint. Allowed datatypes
arestrandunicode.
[rnix]PreventKeyErrorinselect_display_rendererif multivalued selection
and a value no longer available in vocab.
[rnix]2.2.3 (2017-06-12)Fixnumber_extractor. ReturnUNSETif extracted value isUNSET.
CheckminandmaxforNoneexplicitely to ensure0bounds
get considered.
[rnix]2.2.2 (2017-06-07)yafowil.common.generic_datatype_extractorconsidersemptyvalueused
as default empty value for datatype conversion.
[rnix]Improveyafowil.common.select_edit_renderer. Split up code and considerdatatypeandemptyvaluewhen dealing with vocabularies.
[rnix]yafowil.utils.convert_values_to_datatypeandyafowil.utils.convert_value_to_datatypeconsiders empty value handling
and accept defaultempty_valuekeyword argument.
[rnix]Introduceyafowil.utils.EMPTY_VALUEmarker.
[rnix]2.2.1 (2017-05-15)Introducehybrid_rendererandleafwidget property which gets
considered inhybrid_rendererandhybrid_extractor. Usehybrid_rendererindivblueprint.
[rnix]Consider data attributes in div renderer.
[rnix]Fix rendering of empty div renderer.
[rnix]Explicitely check forNoneandUNSETbefore rendering empty value ingeneric_display_renderer.
[rnix]2.2 (2016-10-06)No changes.2.2b2 (2016-09-08)Addyafowil.utils.entry_pointdecorator to control order of entry point
loading.
[rnix, 2016-06-27]2.2b1 (2016-03-01)Fix typo insetup.py, fixes #26
[saily, 2016-03-01]Improveyafowil.base.WidgetAttributesto check attribute containment with__iter__instead of__getitem__catching aKeyError. Speeds up
whole yafowil test suite (including official addon widgets) by approximately
18 percent.
[rnix, 2016-02-07]Fixyafowil.utils.cssid. CSS ID’s must not contain special characters
which get normalized now and should not contain whitespaces which get
replaced by underscore.
[rnix, 2015-11-30]Setpersistfactory default toTrueforhidden,proxy,text,textarea,lines,password,checkbox,select,email,urlandnumberblueprints.
[rnix, 2015-11-26]Introduceyafowil.persistence,RuntimeData.writeandRuntimeData.has_errors.
[rnix, 2015-11-26]Add defaultclassproperty tolinesblueprint.
[rnix, 2015-11-20]Usegeneric_emptyvalue_extractorinhidden,proxy,text,textarea,lines,select,file,password,email,url,searchandnumberblueprints.
[rnix, 2015-11-20]Usegeneric_datatype_extractorinhidden,proxy,text,lines,selectandnumberblueprints.
[rnix, 2015-11-19]Introducegeneric_emptyvalue_extractor.
[rnix, 2015-11-19]Instroducegeneric_datatype_extractor.
[rnix, 2015-11-18]Values inWidget.attrscan also beUNSET.
[rnix, 2015-11-18]Changedefaultvalue ofselectblueprint fromlist()toUNSET. This represents both, an empty single valued and an empty
multi valued selection.
[rnix, 2015-11-18]Fix URL extractor. Must not raise ExtractionError if not required on empty
input.
[rnix, 2015-11-18]2.1.3 (2015-04-12)Fix email extractor. Must not raise ExtractionError if not required on empty
input.
[rnix, 2015-04-11]2.1.2 (2015-01-23)Fixcompound_extractorcase if structural child is structural as well
and skip extraction if so.
[rnix, 2014-08-29]Introduceyafowil.resources.YafowilResourcesclass which can be used
as base for resource publishing specific framework integration code.
[rnix, 2014-08-07]Introduceconfigureentry points. They are executed afterregisterentry points and are supposed to be used for theme configuration (for which
it’s important that all factory defaults are already set)
[rnix, 2014-08-02]Useplumbingdecorator instead ofplumbermetaclass.
[rnix, 2014-08-01]Replace"with&quotfor input values.
[rnix, 2014-07-16]2.1.1 (2014-06-10)Package not ZIP safe.
[chaoflow, 2014-06-10]2.1 (2014-06-03)ConsiderYAFOWIL_FORCE_DUMMY_TSFos.environ variable which can be used
to force dummy translation string factory when running tests.
[rnix, 2014-05-13]Add translations.
[rnix, 2014-04-30]Addyafowil.tsfmodule, which is used to create yafowil related
translation string factory.
[rnix, 2014-04-30]Re-addyafowil.utils.Unsetclass (import fromnode.utils) for
backward compatibility reasons.
[rnix, 2014-04-30]ReturnUNSETin number extractor if received extracted value is empty
string.
[rnix, 2014-03-20]Usegeneric_html5_attrsintag_renderer.
[jensens, 2013-03-06]Add default CSS class forcheckboxandtextareablueprints.
[rnix, 2013-03-06]Float number input seperator may also be comma.
[rnix, 2013-12-02]Don’t generate an id attribute for structural widgets. Fixes #6, where the
same id for all structural elements in a form was generated.
[thet, 2013-05-27]Blueprints acceptdataproperty for generic HTML5 data attributes.
[rnix, 2013-04-11]Introduceyafowil.utils.generic_html5_attrshelper function.
[rnix, 2013-04-11]Introducewith_labelproperty forcheckboxblueprint. Useful for
cross browser compatible checkbox CSS.
[rnix, 2013-03-29]Use json.dumps for data atrribute values to convert Python types to JSON.
Enclose data-attribute values in single quotes to meet the JSON requirements.
Convert camelCase data attribute names into camel-case. Since jQuery 1.6 they
are automatically converted back to camelCase after calling .data().
[thet]Importnode.utils.UNSETinyafowil.utilsinstead of providing own
unset marker class and instance.
[rnix, 2013-02-10]Add helper function for creating a data-attributes dictionary from a list of
attribute-keys which can be passed to tag-renderer.
[thet, 2012-12-05]Allow passing of a custom html attributes dictionary to textarea_renderer,
select_edit_renderer and input_generic_renderer. A dictionary is used instead
of passing them as function parameters to avoid namespace conflicts.
[thet]2.0.2Considermaxlengthininput_attributes_common.
[rnix, 2012-11-03]2.0.1Useattr_valuewherever possible to lookup attribute values.
[rnix, 2012-10-25]Introduceattr_valueutility.
[rnix, 2012-10-25]Textarea can havetitleattribute.
[rnix, 2012-10-25]2.0Fix default help text.
[rnix, 2012-10-10]fixed bug in factory returned wrong renderes on call of display_renderers
[jensens, 2012-10-09]renamed plans to macros.
[rnix, jensens]custom chains can be passed as dictionary to the factory.
[rnix, 2012-09-28]introducedisplay_proxyproperty for modedisplay.
[rnix, 2012-08-08]add generictagblueprint.
[rnix, 2012-08-08]adopt toplumber1.2.
[rnix, 2012-07-29]adopt tonode0.9.8.
[rnix, 2012-07-29]pep8ify
[jensens, 2012-06-08]make TBSupplement compatible with both:`zExceptions`and`zope.exceptions`. Major change: html output is no longer default and
the kwarg of getInfo is now`as_html`(was`html`).
Also added blueprints to the supplement as info to make it easier to identify
the form part.
[jensens, 2012-06-07]1.3.2Check with ‘if not value’ instead of ‘if value is None’ ingeneric_display_renderer.
[thet, 2012-05-23]Add a title attribute to the label blueprint.
[thet, 2012-05-02]Fix file extractor.
[rnix, 2012-04-21]Avoid rendering of value attribute in file blueprint.
[rnix, 2012-04-21]1.3.1Label property can be callable.
[rnix, 2012-02-19]1.3Loading resources is done more explicit and in a pluggable way
using entry-points. Thus yafowil extensions such as widgets
can define an entry point.
[jensens, 2012-02-14]Add size attribute forselectedit renderer.
[jensens, 2012-01-20]fix number extractor
[jensens, 2012-01-20]Add default css class forselectblueprint.
[rnix, 2011-12-18]Registernumberblueprint display renderer.
[rnix, 2011-12-18]Considerexpressioninsubmitblueprint renderer.
[rnix, 2011-12-18]checkedattribute can be set explicitly incheckboxblueprint.
[rnix, 2011-11-21]Fix Bug inyafowil.common.select_edit_renderer. Crashed with empty
vocabularies.
[rnix, 2011-11-16]Addlinesblueprint. Renders a textarea and extracts lines as list.
[rnix, 2011-11-11]Added concept ofplansto the factory, which is a named set of blueprints.
Plans are registered to the factory and can be addressed with the#sign.
[jensens, 2011-09-29]tdblueprint can be used as compound or part of leaf widget now.
[rnix, 2011-09-28]Accept value property on compounds.
[rnix, 2011-09-27]Makedata.extractedavailable asodictwith values of children on
compounds.
[rnix, 2011-09-27]Passblueprintsandcustomarguments to Widget constructor in factory
for debugging and duplication purposes.
[rnix, 2011-09-26]Renameyafowil.base.Widget._propertiestoyafowil.base.Widget.properties.
[rnix, 2011-09-26]Adddivblueprint. Renders within ‘<div>’ element. Can be used for
compound and leaf widgets.
[rnix, 2011-09-23]1.2naming makes a difference between blueprints and widgets
[jensens, 2011-09-20]fix traceback test
[rnix, 2011-09-15]1.1.3traceback supplement now with html support. test for html part is missing for now.
[jensens, 2011-09-01]1.1.2traceback supplement is now better formatted.
[jensens, 2011-08-30]1.1.1Bugfix: modedisplaydid eat up all previous renderings. This made error
widget fail in display mode to show the value. Fixed: empty_display_renderer
proxies now all previous rendered.
[jensens, 2011-08-11]1.1Extend select widget for better UI control of selections and multi selections
[rnix, 2011-08-05]Plumbnode.parts.Orderto widget node
[rnix, 2011-07-28]define label and field renderer as display renderer as well
[rnix, 2011-07-25]deprecate use of mode widget
[rnix, 2011-07-08]now mode is a central element: each Widget instance has a mode now: edit,
display or skip. edit is default and works as usal. Display renders the new
display_renderer chain. Skip just renders an empty Unicode string.
[jensens, 2011-07-07]1.0.4clean up html5 handling, we believe in novalidate now…
[jensens, 2011-06-11]adddisabledattribute for select widget.
[jensens, 2011-06-01]addnovalidateproperty for form
[rnix, 2011-05-23]return empty string in mode renderer if value is UNSET
[rnix, 2011-05-23]1.0.3test coverage
[rnix, 2011-05-07]add widget value validation checking ‘multivalued’ property against ‘value’
length.
[rnix, 2011-05-07]remove outdated_value. userfetch_valueinstead.
[rnix, 2011-05-07]add optionalforproperty for label widget.
[rnix, 2011-04-23]select extractor - fix required behavior
[rnix, 2011-04-19]compound renderer - consider ‘structural’ property on widget node
[rnix, 2011-04-19]number extractor - return val if UNSET
[rnix, 2011-04-14]textarea renderer - check value against None and render empty string instead
[rnix, 2011-04-14]1.0.2Addhtml5typeproperty for email widget
[rnix, 2011-03-16]1.0.1Addhtml5requiredproperty
[rnix, 2011-03-16]1.0adopt to node 0.9 [rnix]documentation [jensens, rnix]1.0-betamade it work [jensens, rnix, et al, 2010-12-27]LicenseCopyright (c) 2010-2021, BlueDynamics Alliance, Austria, Germany, Switzerland
Copyright (c) 2021-2022, Yafowil Contributors
All rights reserved.Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.Redistributions in binary form must reproduce the above copyright notice, this
list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.