diff --git a/README.md b/README.md index 2954a1a..038829f 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,13 @@ This library will generate these tags from your WTForms validators. ## Sample -[Check out the sample here](http://vast-plains-1931.herokuapp.com/parsley_testform). You can also run the sample yourself by calling `run.py` if you have flask installed. +[Check out the sample here](http://vast-plains-1931.herokuapp.com/parsley_testform). You can also run the sample yourself by calling `run_sample.py` if you have flask installed. + +## Installation + +You can install from pypi using + +`pip install wtforms-parsleyjs` ## What is supported? @@ -25,9 +31,9 @@ The following WTForms validators are supported: * Required field * Regexp (see limitations) * URL -* AnyOf +* `AnyOf` -The NoneOf validator is not supported because this functionality is not supported by ParsleyJS. +The `NoneOf` validator is not supported because this functionality is not supported by ParsleyJS. The following WTForms widgets are supported: @@ -53,19 +59,20 @@ Note that the regex validation relies on the regex pattern being compatible with Notably the ECMA script default behaviour matches the behaviour of [Python's search, not match](http://docs.python.org/2/library/re.html#search-vs-match). -It's possible to simply supply your own `data-regexp` keyword to the field to explicitly provide the ECMA script regex. - -See [the flask documentation on this](http://flask.pocoo.org/docs/patterns/wtforms/#forms-in-templates). If you do this the library will not touch your custom regex. +It's possible to simply supply your own `data-regexp` keyword to the field to explicitly provide the ECMA script regex. See [the flask documentation on this](http://flask.pocoo.org/docs/patterns/wtforms/#forms-in-templates). If you do this the library will not touch your custom regex. Note that the WTForms URL vaidator probably is a bit more liberal than the parsley one. Do check if the behaviour suits your needs. +WTForms-ParsleyJS has been developed and run solely on Python 2.7. - but it may work with other versions. + ## Dependencies Of course ParsleyJS and WTForms are required. ParsleyJS in turn requires jQuery. The `AnyOf` validator requires parsleys extra validators which are distributed in a seperate file. -The sample uses the [Flask web framework](http://flask.pocoo.org/docs/) and [Twitter Bootstrap](http://twitter.github.io/bootstrap/). Because the sample should run out of the box, ParsleyJS is included as a git submodule. +The sample uses the [Flask web framework](http://flask.pocoo.org/docs/) and [Twitter Bootstrap](http://twitter.github.io/bootstrap/). Because the sample should run out of the box on Heroku, ParsleyJS is included as a git submodule. + ## What else? diff --git a/run.py b/run_sample.py similarity index 100% rename from run.py rename to run_sample.py diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..7765519 --- /dev/null +++ b/setup.py @@ -0,0 +1,49 @@ +""" +# WTForms-ParsleyJS + +This is a small library which you can hook into your WTForms form classes in order to +enable client side validation. + +WTForms allows you to validate your forms on the server side. Ideally, we could reuse +these validators on the client side with JavaScript without writing any extra code. This +will allow for more direct user feedback in our forms. + +This library uses ParsleyJS for this task. ParsleyJS is a popular client side +JavaScript validation library. It is configured using specific HTML markup in the forms. + +This library will generate these tags from your WTForms validators. + +For more information consult the README.md in the Github repository at +https://github.com/johannes-gehrs/wtforms-parsleyjs + +""" +from setuptools import setup + +setup( + name='WTForms-ParsleyJS', + version='0.1', + url='https://github.com/johannes-gehrs/wtforms-parsleyjs', + license='MIT', + author='Johannes Gehrs', + author_email='jgehrs@gmail.com', + description='Generate client side, parsley.js validation tags automatically ' + 'from WTForms server side validators.', + long_description=__doc__, + py_modules = ['run_sample'], + packages=['wtformsparsleyjs', 'wtformsparsleyjs.sample'], + platforms='any', + install_requires=[ + 'WTForms>=1.0.4' + ], + classifiers=[ + 'Development Status :: 4 - Beta', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: MIT License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2.7', + 'Topic :: Internet :: WWW/HTTP :: Dynamic Content', + 'Topic :: Software Development :: Libraries :: Python Modules' + ] +) \ No newline at end of file diff --git a/wtformsparsleyjs/sample/templates/base.html b/wtformsparsleyjs/sample/templates/base.html index d62823a..889f604 100644 --- a/wtformsparsleyjs/sample/templates/base.html +++ b/wtformsparsleyjs/sample/templates/base.html @@ -2,7 +2,7 @@ - WTForms-Parsley Sample + WTForms-ParsleyJS Sample