diff --git a/.gitignore b/.gitignore index 778b82c..b1030f7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ develop-eggs parts .coverage htmlcov +docs/_build diff --git a/CHANGES.txt b/CHANGES.rst similarity index 100% rename from CHANGES.txt rename to CHANGES.rst diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..5538536 --- /dev/null +++ b/README.rst @@ -0,0 +1,15 @@ +This package provides different additional Zope 3 schema fields. + +The provided fields include support for: + +- Base URLs +- Date selection +- RFC 822 mail addresses +- Hostnames and IP addresses +- Credit card numbers +- Regular expressions +- Optional choices + +Complete documentation can be found at https://z3cschema.readthedocs.io. + +The `full change log `_ is available. diff --git a/README.txt b/README.txt deleted file mode 100644 index ea9e226..0000000 --- a/README.txt +++ /dev/null @@ -1 +0,0 @@ -This package provides different additional Zope 3 schema fields. diff --git a/doc-requirements.txt b/doc-requirements.txt new file mode 100644 index 0000000..5429a4e --- /dev/null +++ b/doc-requirements.txt @@ -0,0 +1,4 @@ +pip>=8.1.2 +setuptools>=23.0.0 +repoze.sphinx.autointerface +sphinx_rtd_theme diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..a272e8f --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,225 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " applehelp to make an Apple Help Book" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " epub3 to make an epub3" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " xml to make Docutils-native XML files" + @echo " pseudoxml to make pseudoxml-XML files for display purposes" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + @echo " coverage to run coverage check of the documentation (if enabled)" + @echo " dummy to check syntax errors of document sources" + +.PHONY: clean +clean: + rm -rf $(BUILDDIR)/* + +.PHONY: html +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +.PHONY: dirhtml +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +.PHONY: singlehtml +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +.PHONY: pickle +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +.PHONY: json +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +.PHONY: htmlhelp +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +.PHONY: qthelp +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/z3cschema.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/z3cschema.qhc" + +.PHONY: applehelp +applehelp: + $(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp + @echo + @echo "Build finished. The help book is in $(BUILDDIR)/applehelp." + @echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + +.PHONY: devhelp +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/z3cschema" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/z3cschema" + @echo "# devhelp" + +.PHONY: epub +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +.PHONY: epub3 +epub3: + $(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3 + @echo + @echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3." + +.PHONY: latex +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +.PHONY: latexpdf +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: latexpdfja +latexpdfja: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through platex and dvipdfmx..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: text +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +.PHONY: man +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +.PHONY: texinfo +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +.PHONY: info +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +.PHONY: gettext +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +.PHONY: changes +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +.PHONY: linkcheck +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +.PHONY: doctest +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +.PHONY: coverage +coverage: + $(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage + @echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + +.PHONY: xml +xml: + $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml + @echo + @echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +.PHONY: pseudoxml +pseudoxml: + $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml + @echo + @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + +.PHONY: dummy +dummy: + $(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy + @echo + @echo "Build finished. Dummy builder generates no files." diff --git a/doc/baseurl.rst b/doc/baseurl.rst new file mode 100644 index 0000000..e10c1a9 --- /dev/null +++ b/doc/baseurl.rst @@ -0,0 +1,8 @@ +.. include:: ../src/z3c/schema/baseurl/README.txt + +Reference +========= + +.. automodule:: z3c.schema.baseurl.interfaces + +.. automodule:: z3c.schema.baseurl.field diff --git a/doc/changelog.rst b/doc/changelog.rst new file mode 100644 index 0000000..d9e113e --- /dev/null +++ b/doc/changelog.rst @@ -0,0 +1 @@ +.. include:: ../CHANGES.rst diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 0000000..6c33303 --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,362 @@ +# -*- coding: utf-8 -*- +# +# z3c.schema documentation build configuration file, created by +# sphinx-quickstart on Tue Sep 13 15:00:43 2016. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode', + 'sphinx.ext.extlinks', + 'repoze.sphinx.autointerface', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +# +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = u'z3c.schema' +copyright = u'2016, Zope Community' +author = u'Zope Community' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The full version, including alpha/beta/rc tags. +with open('../version.txt') as f: + release = f.read().strip() + +# The short X.Y version. +version = '.'.join(release.split('.')[:2]) + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# +# today = '' +# +# Else, today_fmt is used as the format for a strftime call. +# +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'sphinx_rtd_theme' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. +# " v documentation" by default. +# +# html_title = u'z3c.schema vXXX' + +# A shorter title for the navigation bar. Default is the same as html_title. +# +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# +# html_logo = None + +# The name of an image file (relative to this directory) to use as a favicon of +# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# +# html_extra_path = [] + +# If not None, a 'Last updated on:' timestamp is inserted at every page +# bottom, using the given strftime format. +# The empty string is equivalent to '%b %d, %Y'. +# +# html_last_updated_fmt = None + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# +# html_additional_pages = {} + +# If false, no module index is generated. +# +# html_domain_indices = True + +# If false, no index is generated. +# +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'hu', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'ru', 'sv', 'tr', 'zh' +# +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# 'ja' uses this config value. +# 'zh' user can custom change `jieba` dictionary path. +# +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'z3cschemadoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'z3cschema.tex', u'z3c.schema Documentation', + u'Zope Community', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# +# latex_use_parts = False + +# If true, show page references after internal links. +# +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# +# latex_appendices = [] + +# It false, will not define \strong, \code, itleref, \crossref ... but only +# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added +# packages. +# +# latex_keep_old_macro_names = True + +# If false, no module index is generated. +# +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'z3cschema', u'z3c.schema Documentation', + [author], 1) +] + +# If true, show URL addresses after external links. +# +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'z3cschema', u'z3c.schema Documentation', + author, 'z3cschema', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +# +# texinfo_appendices = [] + +# If false, no module index is generated. +# +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = { + 'https://docs.python.org/': None, + 'http://zopeschema.readthedocs.io/en/latest/': None, +} + +extlinks = {'issue': ('https://github.com/zopefoundation/z3c.schema/issues/%s', + 'issue #'), + 'pr': ('https://github.com/zopefoundation/z3c.schema/pull/%s', + 'pull request #')} + +autodoc_default_flags = ['members', 'show-inheritance'] +autoclass_content = 'both' +autodoc_member_order = 'bysource' diff --git a/doc/dateselect.rst b/doc/dateselect.rst new file mode 100644 index 0000000..658fec5 --- /dev/null +++ b/doc/dateselect.rst @@ -0,0 +1,8 @@ +.. include:: ../src/z3c/schema/dateselect/README.txt + +Reference +========= + +.. autoclass:: z3c.schema.dateselect.IDateSelect + +.. autoclass:: z3c.schema.dateselect.DateSelect diff --git a/doc/email.rst b/doc/email.rst new file mode 100644 index 0000000..e95a6c2 --- /dev/null +++ b/doc/email.rst @@ -0,0 +1,8 @@ +.. include:: ../src/z3c/schema/email/README.txt + +Reference +========= + +.. automodule:: z3c.schema.email.interfaces + +.. automodule:: z3c.schema.email.field diff --git a/doc/hostname.rst b/doc/hostname.rst new file mode 100644 index 0000000..0f28b74 --- /dev/null +++ b/doc/hostname.rst @@ -0,0 +1,8 @@ +.. include:: ../src/z3c/schema/hostname/README.txt + +Reference +========= + +.. automodule:: z3c.schema.hostname.interfaces + +.. automodule:: z3c.schema.hostname.field diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 0000000..9ddc018 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,46 @@ +===================== + What is z3c.schema? +===================== + +z3c.schema provides additional Zope 3 schema fields. + +.. toctree:: + :maxdepth: 1 + + baseurl + dateselect + email + hostname + ip + optchoice + payments + regex + + +.. toctree:: + :maxdepth: 2 + + changelog + +Development +=========== + +z3c.schema is hosted at GitHub: + + https://github.com/zopefoundation/z3c.schema/ + + + +Project URLs +============ + +* http://pypi.python.org/pypi/z3c.schema (PyPI entry and downloads) + + +==================== + Indices and tables +==================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/doc/ip.rst b/doc/ip.rst new file mode 100644 index 0000000..f2c0326 --- /dev/null +++ b/doc/ip.rst @@ -0,0 +1,8 @@ +.. include:: ../src/z3c/schema/ip/README.txt + +Reference +========= + +.. automodule:: z3c.schema.ip.interfaces + +.. automodule:: z3c.schema.ip.field diff --git a/doc/optchoice.rst b/doc/optchoice.rst new file mode 100644 index 0000000..0065e1b --- /dev/null +++ b/doc/optchoice.rst @@ -0,0 +1,8 @@ +.. include:: ../src/z3c/schema/optchoice/README.txt + +Reference +========= + +.. automodule:: z3c.schema.optchoice.interfaces + +.. automodule:: z3c.schema.optchoice.field diff --git a/doc/payments.rst b/doc/payments.rst new file mode 100644 index 0000000..dcc8ded --- /dev/null +++ b/doc/payments.rst @@ -0,0 +1,8 @@ +.. include:: ../src/z3c/schema/payments/README.txt + +Reference +========= + +.. automodule:: z3c.schema.payments.interfaces + +.. automodule:: z3c.schema.payments.field diff --git a/doc/regex.rst b/doc/regex.rst new file mode 100644 index 0000000..ce95d71 --- /dev/null +++ b/doc/regex.rst @@ -0,0 +1,8 @@ +.. include:: ../src/z3c/schema/regex/README.txt + +Reference +========= + +.. automodule:: z3c.schema.regex.interfaces + +.. automodule:: z3c.schema.regex.field diff --git a/setup.py b/setup.py index 5dd2920..23a01a6 100644 --- a/setup.py +++ b/setup.py @@ -38,22 +38,12 @@ def alltests(): setup( name = 'z3c.schema', - version='1.0.1.dev0', + version=read('version.txt').strip(), author = 'Zope Community', author_email = "zope-dev@zope.org", description = "Additional schema fields for Zope 3", long_description=( - read('README.txt') + - '.. contents::\n\n'+ - read('CHANGES.txt') + - read('src', 'z3c', 'schema', 'baseurl', 'README.txt') + - read('src', 'z3c', 'schema', 'dateselect', 'README.txt') + - read('src', 'z3c', 'schema', 'email', 'README.txt') + - read('src', 'z3c', 'schema', 'hostname', 'README.txt') + - read('src', 'z3c', 'schema', 'ip', 'README.txt') + - read('src', 'z3c', 'schema', 'optchoice', 'README.txt') + - read('src', 'z3c', 'schema', 'payments', 'README.txt') + - read('src', 'z3c', 'schema', 'regex', 'README.txt') + read('README.rst') ), license = 'ZPL 2.1', keywords = 'zope zope3 z3c schema', diff --git a/src/z3c/schema/baseurl/README.txt b/src/z3c/schema/baseurl/README.txt index 4edf030..c21b4c8 100644 --- a/src/z3c/schema/baseurl/README.txt +++ b/src/z3c/schema/baseurl/README.txt @@ -1,9 +1,12 @@ -======== +====== + URLs +====== + BaseURL -======== +======= -A base url field is useful if you need to append view names to a url and -doesn't like to check every time if the url ends with a backslash before you +A base url field is useful if you need to append view names to a url and +doesn't like to check every time if the url ends with a backslash before you append the view name. Let's first create the BaseURL field: diff --git a/src/z3c/schema/baseurl/field.py b/src/z3c/schema/baseurl/field.py index e768e44..01b13a9 100644 --- a/src/z3c/schema/baseurl/field.py +++ b/src/z3c/schema/baseurl/field.py @@ -12,7 +12,6 @@ # ############################################################################## """ -$Id:$ """ __docformat__ = "reStructuredText" @@ -23,7 +22,7 @@ from z3c.schema.baseurl import interfaces - +#: Determine whether the URL is a base URL. isValidBaseURL = re.compile( r"[a-zA-Z0-9+.-]+:" # scheme r"\S*$" # non space (should be pickier) @@ -33,7 +32,7 @@ @zope.interface.implementer(interfaces.IBaseURL) class BaseURL(zope.schema.URI): """Base URL field. - + Such a base url must end with a ``/``. This makes it simpler for append a view name. """ diff --git a/src/z3c/schema/baseurl/interfaces.py b/src/z3c/schema/baseurl/interfaces.py index 97ec3f6..1edb179 100644 --- a/src/z3c/schema/baseurl/interfaces.py +++ b/src/z3c/schema/baseurl/interfaces.py @@ -12,7 +12,6 @@ # ############################################################################## """ -$Id$ """ __docformat__ = "reStructuredText" @@ -22,10 +21,10 @@ from z3c.schema.i18n import MessageFactory as _ -class IBaseURL(zope.schema.interfaces.IURI, - zope.schema.interfaces.IFromUnicode): +class IBaseURL(zope.schema.interfaces.IURI, + zope.schema.interfaces.IFromUnicode): """Base URL field. - + Such a base url must end with a ``/``. This makes it simpler for append a view name. """ diff --git a/src/z3c/schema/dateselect/README.txt b/src/z3c/schema/dateselect/README.txt index 98d4600..98cf508 100644 --- a/src/z3c/schema/dateselect/README.txt +++ b/src/z3c/schema/dateselect/README.txt @@ -1,10 +1,10 @@ -======================== -The Date Selection Field -======================== +================ + Date Selection +================ The date selection field was designed to support the UI requirement of allowing users to select a date using multi-select input fields. The -``DateSelect`` field extends the ``Date`` field merely by a few additional +``DateSelect`` field extends the :class:`zope.schema.Date` field merely by a few additional attributes. >>> from z3c.schema.dateselect import field @@ -31,5 +31,5 @@ The second attribute allows you to specify an initial date for the selection: >>> birthday.initialDate datetime.date(2000, 1, 1) -And this is really it. Please read the documentation on the ``Date`` for more +And this is really it. Please read the documentation on the :class:`~zope.schema.Date` for more information. diff --git a/src/z3c/schema/email/README.txt b/src/z3c/schema/email/README.txt index 8b75ddb..90a3a36 100644 --- a/src/z3c/schema/email/README.txt +++ b/src/z3c/schema/email/README.txt @@ -39,7 +39,7 @@ easier to use it for the tests: >>> isValidMailAddress(u'foo.blah@bar.com') True - # Name failures +* Name failures >>> isValidMailAddress(u'foo\r@bar.com') False @@ -48,7 +48,7 @@ easier to use it for the tests: >>> isValidMailAddress(u'foo:@bar.com') False - # Overall failures +* Overall failures >>> isValidMailAddress(u'') False @@ -61,7 +61,7 @@ easier to use it for the tests: >>> isValidMailAddress(u'foo@bar.com.') False - # Domain failures +* Domain failures >>> isValidMailAddress(u'foo@') False diff --git a/src/z3c/schema/email/field.py b/src/z3c/schema/email/field.py index ab12bf0..8b8f1f0 100644 --- a/src/z3c/schema/email/field.py +++ b/src/z3c/schema/email/field.py @@ -12,7 +12,7 @@ # ############################################################################## """ -$Id$ + """ __docformat__ = "reStructuredText" @@ -76,7 +76,6 @@ def isValidMailAddress(addr): @zope.interface.implementer(interfaces.IRFC822MailAddress) class RFC822MailAddress(zope.schema.TextLine): """A valid email address.""" - __doc__ = interfaces.IRFC822MailAddress.__doc__ def constraint(self, value): return '\n' not in value and '\r' not in value diff --git a/src/z3c/schema/email/interfaces.py b/src/z3c/schema/email/interfaces.py index 9a2e688..4fec46e 100644 --- a/src/z3c/schema/email/interfaces.py +++ b/src/z3c/schema/email/interfaces.py @@ -12,7 +12,7 @@ # ############################################################################## """ -$Id$ + """ __docformat__ = "reStructuredText" diff --git a/src/z3c/schema/hostname/field.py b/src/z3c/schema/hostname/field.py index 54470a4..1c51aca 100644 --- a/src/z3c/schema/hostname/field.py +++ b/src/z3c/schema/hostname/field.py @@ -12,7 +12,6 @@ # ############################################################################## """ -$Id:$ """ __docformat__ = "reStructuredText" @@ -24,6 +23,7 @@ from z3c.schema.hostname import interfaces +#: Check for a valid hostname. isValidHostName = re.compile( # BEGIN: host diff --git a/src/z3c/schema/hostname/interfaces.py b/src/z3c/schema/hostname/interfaces.py index 2281ccb..5d9b0e5 100644 --- a/src/z3c/schema/hostname/interfaces.py +++ b/src/z3c/schema/hostname/interfaces.py @@ -12,7 +12,7 @@ # ############################################################################## """ -$Id$ + """ __docformat__ = "reStructuredText" @@ -22,7 +22,7 @@ from z3c.schema.i18n import MessageFactory as _ -class IHostName(zope.schema.interfaces.IURI, +class IHostName(zope.schema.interfaces.IURI, zope.schema.interfaces.IFromUnicode): """Host name field.""" diff --git a/src/z3c/schema/ip/README.txt b/src/z3c/schema/ip/README.txt index 00d30aa..21aa1a3 100644 --- a/src/z3c/schema/ip/README.txt +++ b/src/z3c/schema/ip/README.txt @@ -1,6 +1,6 @@ -================ -IP Address Field -================ +============== + IP Addresses +============== This module provides a field for IP addresses. Let's first generate an IP field: @@ -31,7 +31,7 @@ easier to use it for the tests: >>> isValidIPAddress('255.255.255.255') True - # Number of pieces failures +* Number of pieces failures >>> isValidIPAddress('12.3.1') False @@ -40,14 +40,14 @@ easier to use it for the tests: >>> isValidIPAddress('1.0.0.0.') False - # Not integers failures +* Not integers failures >>> isValidIPAddress('x.0.0.0') False >>> isValidIPAddress('0x8.0.0.0') False - # Not in range failures +* Not in range failures >>> isValidIPAddress('-1.0.0.0') False diff --git a/src/z3c/schema/ip/field.py b/src/z3c/schema/ip/field.py index c490664..121a36a 100644 --- a/src/z3c/schema/ip/field.py +++ b/src/z3c/schema/ip/field.py @@ -11,7 +11,7 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## -"""IP Address +""" """ import zope.interface import zope.schema diff --git a/src/z3c/schema/optchoice/field.py b/src/z3c/schema/optchoice/field.py index 0d4e9fa..daa7b27 100644 --- a/src/z3c/schema/optchoice/field.py +++ b/src/z3c/schema/optchoice/field.py @@ -12,7 +12,6 @@ # ############################################################################## """ -$Id:$ """ __docformat__ = "reStructuredText" diff --git a/src/z3c/schema/optchoice/interfaces.py b/src/z3c/schema/optchoice/interfaces.py index 3d5d947..7008ef7 100644 --- a/src/z3c/schema/optchoice/interfaces.py +++ b/src/z3c/schema/optchoice/interfaces.py @@ -12,7 +12,6 @@ # ############################################################################## """ -$Id$ """ __docformat__ = "reStructuredText" diff --git a/src/z3c/schema/payments/README.txt b/src/z3c/schema/payments/README.txt index c837ece..9342f43 100644 --- a/src/z3c/schema/payments/README.txt +++ b/src/z3c/schema/payments/README.txt @@ -1,6 +1,6 @@ -=================== -z3c.schema.payments -=================== +============================= + Payment Data (Credit Cards) +============================= z3c.schema.payments provides some level of error detection in payment data prior to storing the information or sending it to a payment processor. @@ -9,7 +9,7 @@ this could conceivably be extended to other payment forms Credit Cards ------------- +============ Credit card numbering specifications are defined in ISO 7812-1:1983. Verifying that the credit card number supplied by a user conforms to the ISO standard diff --git a/src/z3c/schema/payments/field.py b/src/z3c/schema/payments/field.py index 282a5fa..30adead 100644 --- a/src/z3c/schema/payments/field.py +++ b/src/z3c/schema/payments/field.py @@ -11,7 +11,7 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## -"""ISO 7812 Credit Card +""" """ import zope.interface from . import interfaces @@ -20,7 +20,7 @@ def isValidCreditCard(cardNum): """Returns True if the credit card number is a valid Luhn (Mod 10) number and False if not. This, of course, does not validate the number, but will catch typos. There is the chance that two typographic errors could - return a false positive if they offset one anoter, but the likelihood + return a false positive if they offset one another, but the likelihood is low and pre-validating is fast""" financialIndustries = ['3','4','5','6'] diff --git a/src/z3c/schema/payments/interfaces.py b/src/z3c/schema/payments/interfaces.py index 3e88ce9..5c6faca 100644 --- a/src/z3c/schema/payments/interfaces.py +++ b/src/z3c/schema/payments/interfaces.py @@ -12,7 +12,6 @@ # ############################################################################## """ -$Id:$ """ __docformat__ = "reStructuredText" @@ -24,6 +23,6 @@ class IISO7812CreditCard(zope.schema.interfaces.ITextLine): """A credit card with a valid check digit""" - + class NotValidISO7812CreditCard(zope.schema.ValidationError): - __doc__ = _("""The credit card number is incorrect.""") \ No newline at end of file + __doc__ = _("""The credit card number is incorrect.""") diff --git a/src/z3c/schema/regex/README.txt b/src/z3c/schema/regex/README.txt index 5fd3a52..f56c071 100644 --- a/src/z3c/schema/regex/README.txt +++ b/src/z3c/schema/regex/README.txt @@ -1,6 +1,6 @@ -======================== -Regular expression field -======================== +===================== + Regular Expressions +===================== Let's first create the regex field. @@ -19,7 +19,7 @@ It does not validate regular expressions that do not compile. ... InvalidRegex: '(i', unbalanced parenthesis -When used to process input, only valid values are returned +When used to process input, only valid values are returned. >>> regex.fromUnicode(u'.*') '.*' diff --git a/src/z3c/schema/regex/field.py b/src/z3c/schema/regex/field.py index 2dc8838..80c2043 100644 --- a/src/z3c/schema/regex/field.py +++ b/src/z3c/schema/regex/field.py @@ -12,7 +12,6 @@ # ############################################################################## """ -$Id:$ """ __docformat__ = "reStructuredText" diff --git a/src/z3c/schema/regex/interfaces.py b/src/z3c/schema/regex/interfaces.py index f6d69fd..6bda866 100644 --- a/src/z3c/schema/regex/interfaces.py +++ b/src/z3c/schema/regex/interfaces.py @@ -12,7 +12,6 @@ # ############################################################################## """ -$Id$ """ __docformat__ = "reStructuredText" diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..cae4856 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +1.1.0.dev0