{ "info": { "author": "Brendan Doms", "author_email": "b@bdoms.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "Copyright © 2014-2019, [Brendan Doms](http://www.bdoms.com/) \nLicensed under the [MIT license](http://www.opensource.org/licenses/MIT)\n\n# GAE Validators\n\nGAE Validators provides user input validation methods with smart defaults for the Google App Engine datastore.\n\n## Build Status\n\n![Python 2 Tests](https://api.cirrus-ci.com/github/bdoms/gae_validators.svg?task=python2_tests)\n![Python 3 Tests](https://api.cirrus-ci.com/github/bdoms/gae_validators.svg?task=python3_tests)\n![Flake8 Linter](https://api.cirrus-ci.com/github/bdoms/gae_validators.svg?task=flake8)\n![Build Package](https://api.cirrus-ci.com/github/bdoms/gae_validators.svg?task=build_package)\n\n## How It Works\n\nEach validator is simply a method that receives string input and returns a tuple of `(valid, value)` back.\n`valid` is simply a boolean of whether the input passed validation or not.\n`value` is a coerced, potentially optimized version of the input.\nFor example, strings have outer whitespace stripped, while integers, booleans, and dates are all returned as their respective type.\n\nSome validators have additional parameters to help configure how validation should be done.\nBy default, these are all defined to match the restrictions of the\n[GAE properties](https://cloud.google.com/appengine/docs/python/datastore/typesandpropertyclasses).\nIn theory you could support any datastore backend simply by changing the configuration parameters.\n\n## Example Use\n\nThe normal flow of a program would be to get some user input from a form, pull it out of the request, and validate it.\nIf validation passes for all the fields, then update the datastore, if not, then return helpful errors to the user.\nFor example:\n\n\n```python\nfrom gae_validators import validateEmail\n\nclass ExampleHandler(webapp2.RequestHandler):\n\n def post(self):\n\n form_email = self.request.get(\"email\")\n\n is_valid, validated_email = validateEmail(form_email)\n\n if is_valid:\n user.email = validated_email\n user.put()\n else:\n self.redirect(\"/user/update?errors=email\")\n```\n\n## Available Validators\n\nHere are all the function signatures with their default configuration values:\n\n```python\nvalidateString(source, max_length=500, newlines=False, encoding='utf-8')\n\nvalidateRequiredString(source, min_length=1, max_length=500, newlines=False, encoding='utf-8')\n# same as above execpt that a string below the min_length will fail\n\nvalidateText(source, max_length=ONE_MB, newlines=True, encoding='utf-8')\n# ONE_MB is defined as 2 ** 20\n\nvalidateRequiredText(source, min_length=1, max_length=ONE_MB, newlines=True, encoding='utf-8')\n\nvalidateEmail(source)\n\nvalidateRequiredEmail(source)\n\nvalidatePhone(source)\n# returns the number in a good approximation of E.164 format\n# this should work exactly for numbers with country code 1 (US and Canada)\n# however it will not be correct in all cases for all countries\n# you'll need a different solution if you want full international support\n\nvalidateRequiredPhone(source)\n\nvalidateUrl(source)\n# only http and https schemes are supported\n\nvalidateRequiredUrl(source)\n\nvalidateChoices(source, choices)\n# choices should be an iterable\n\nvalidateRequiredChoices(source, choices)\n\nvalidateBool(source)\n# any value can be truthy or falsy\n# so there is no required version of validateBool, and it will never return an invalid result\n\nvalidateInt(source, min_amount=-INT_SIZE, max_amount=INT_SIZE - 1)\n# INT_SIZE is defined as a 64 bit signed integer, which means 2 ** 63\n\nvalidateRequiredInt(source, min_amount=-INT_SIZE, max_amount=INT_SIZE - 1)\n\nvalidateFloat(source, min_amount=-INT_SIZE, max_amount=INT_SIZE - 1)\n\nvalidateRequiredFloat(source, min_amount=-INT_SIZE, max_amount=INT_SIZE - 1)\n\nvalidateDateTime(source, date_format=\"%Y-%m-%dT%H:%M\", future_only=False, past_only=False)\n\nvalidateRequiredDateTime(source, date_format=\"%Y-%m-%dT%H:%M\", future_only=False, past_only=False)\n\nvalidateDate(source, date_format=\"%Y-%m-%d\", future_only=False, past_only=False)\n\nvalidateRequiredDate(source, date_format=\"%Y-%m-%d\", future_only=False, past_only=False)\n\nvalidateTime(source, time_format=\"%H:%M\")\n\nvalidateRequiredTime(source, time_format=\"%H:%M\")\n```\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bdoms/gae_validators", "keywords": "validation,google app engine,datastore,forms", "license": "MIT", "maintainer": "Brendan Doms", "maintainer_email": "b@bdoms.com", "name": "gae-validators", "package_url": "https://pypi.org/project/gae-validators/", "platform": "", "project_url": "https://pypi.org/project/gae-validators/", "project_urls": { "Homepage": "https://github.com/bdoms/gae_validators", "Repository": "https://github.com/bdoms/gae_validators" }, "release_url": "https://pypi.org/project/gae-validators/1.0.2/", "requires_dist": null, "requires_python": ">=2.0,<4.0", "summary": "User input validation with defaults for the Google App Engine datastore.", "version": "1.0.2" }, "last_serial": 5972413, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "3d50c6cea074209962b444362ab6d7ad", "sha256": "7188d4ed48fb5034a3af7214beb1b928c7a62e0442e84f9c87936ff78a77eca7" }, "downloads": -1, "filename": "gae_validators-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3d50c6cea074209962b444362ab6d7ad", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.0,<4.0", "size": 5263, "upload_time": "2019-06-03T01:10:41", "url": "https://files.pythonhosted.org/packages/ee/0e/bdcf1e2947517db5f9a08f43a12fc1f248ee0dfeb33b3190a7c2260e1eb9/gae_validators-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1db2de138358d7019d40150a44753906", "sha256": "4b3ff3d988e7164a7a2d3ba1119bfa3ec784e9b92e15ab014c539cc00382935e" }, "downloads": -1, "filename": "gae_validators-1.0.0.tar.gz", "has_sig": false, "md5_digest": "1db2de138358d7019d40150a44753906", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.0,<4.0", "size": 5104, "upload_time": "2019-06-03T01:10:44", "url": "https://files.pythonhosted.org/packages/5c/d8/7d12165b72a246b211be70d67ff3c6bde6eb699413bb4c4200b8e0d8800c/gae_validators-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "23dbba7457fa42ea48cb15c94f26833b", "sha256": "5f4ec0abe48ebf92707ba078b4866af50c451d3c5812210efb58f29c2dd2cede" }, "downloads": -1, "filename": "gae_validators-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "23dbba7457fa42ea48cb15c94f26833b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.0,<4.0", "size": 5309, "upload_time": "2019-06-05T14:00:24", "url": "https://files.pythonhosted.org/packages/cf/7f/4d0f11252e2ca61a9e6500d40f7bb0b6a7c6bdc7dae8dd4c98fc9cbf49b1/gae_validators-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "53f199af36153d7c893eb4f0bb3a5c58", "sha256": "104c883ae01d0858406c6382e54515ba06b373b633667a05607ae194fe68ce86" }, "downloads": -1, "filename": "gae_validators-1.0.1.tar.gz", "has_sig": false, "md5_digest": "53f199af36153d7c893eb4f0bb3a5c58", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.0,<4.0", "size": 5185, "upload_time": "2019-06-05T14:00:26", "url": "https://files.pythonhosted.org/packages/4f/1f/973de4371c765961262142d6cb93866dd36063e0c6a3fab74d8872dcc77d/gae_validators-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "503328d88844671766761f68786c39a7", "sha256": "93c9e8248d31285faa45f1f8433df87f93c00e815bd919662eca85313e5cca32" }, "downloads": -1, "filename": "gae_validators-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "503328d88844671766761f68786c39a7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.0,<4.0", "size": 5354, "upload_time": "2019-10-14T17:00:29", "url": "https://files.pythonhosted.org/packages/c1/63/da01c473e12121a145e5fe62b1a4ebd6ff83184e4caaaa487889e4933cdf/gae_validators-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0b2a61130c046f18da265b1f9200fd3a", "sha256": "e286f806cef855d0874fad2e6f0d227a1a5458de8df990c88a3796ae118502fc" }, "downloads": -1, "filename": "gae_validators-1.0.2.tar.gz", "has_sig": false, "md5_digest": "0b2a61130c046f18da265b1f9200fd3a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.0,<4.0", "size": 5211, "upload_time": "2019-10-14T17:00:30", "url": "https://files.pythonhosted.org/packages/12/d7/a046ea23620752576ce163939f614c46e23027c852a1fbcd76d4c97c43d1/gae_validators-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "503328d88844671766761f68786c39a7", "sha256": "93c9e8248d31285faa45f1f8433df87f93c00e815bd919662eca85313e5cca32" }, "downloads": -1, "filename": "gae_validators-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "503328d88844671766761f68786c39a7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=2.0,<4.0", "size": 5354, "upload_time": "2019-10-14T17:00:29", "url": "https://files.pythonhosted.org/packages/c1/63/da01c473e12121a145e5fe62b1a4ebd6ff83184e4caaaa487889e4933cdf/gae_validators-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "0b2a61130c046f18da265b1f9200fd3a", "sha256": "e286f806cef855d0874fad2e6f0d227a1a5458de8df990c88a3796ae118502fc" }, "downloads": -1, "filename": "gae_validators-1.0.2.tar.gz", "has_sig": false, "md5_digest": "0b2a61130c046f18da265b1f9200fd3a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=2.0,<4.0", "size": 5211, "upload_time": "2019-10-14T17:00:30", "url": "https://files.pythonhosted.org/packages/12/d7/a046ea23620752576ce163939f614c46e23027c852a1fbcd76d4c97c43d1/gae_validators-1.0.2.tar.gz" } ] }