{ "info": { "author": "Randy Syring", "author_email": "randy.syring@level12.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Topic :: Database" ], "description": "SAValidation\n############\n\n.. image:: https://ci.appveyor.com/api/projects/status/92uq13xnk8woa59d?svg=true\n :target: https://ci.appveyor.com/project/level12/sqlalchemy-validation\n\n.. image:: https://circleci.com/gh/blazelibs/sqlalchemy-validation.svg?&style=shield\n :target: https://circleci.com/gh/blazelibs/sqlalchemy-validation\n\n.. image:: https://codecov.io/github/blazelibs/sqlalchemy-validation/coverage.svg?branch=master\n :target: https://codecov.io/github/blazelibs/sqlalchemy-validation?branch=master\n\nIntroduction\n------------\n\nSAValidation facilitates Active Record like validation on SQLAlchemy declarative model\nobjects.\n\nYou can install the `in-development version\n`_\nof savalidation with ``easy_install savalidation==dev``.\n\nThe home page is currently the `GitHub repository\n`_.\n\nUsage Example\n-------------\n\nThe following is a snippet from the examples.py file:\n\n.. code-block:: python\n\n from datetime import datetime\n import formencode\n import sqlalchemy as sa\n import sqlalchemy.ext.declarative as sadec\n import sqlalchemy.sql as sasql\n import sqlalchemy.orm as saorm\n\n from savalidation import ValidationMixin, watch_session\n import savalidation.validators as val\n\n engine = sa.create_engine('sqlite://')\n #engine.echo = True\n meta = sa.MetaData()\n Base = sadec.declarative_base(metadata=meta)\n\n Session = saorm.scoped_session(\n saorm.sessionmaker(\n bind=engine,\n autoflush=False\n )\n )\n\n sess = Session\n\n class Family(Base, ValidationMixin):\n __tablename__ = 'families'\n\n # SA COLUMNS\n id = sa.Column(sa.Integer, primary_key=True)\n createdts = sa.Column(sa.DateTime, nullable=False, default=datetime.now, server_default=sasql.text('CURRENT_TIMESTAMP'))\n updatedts = sa.Column(sa.DateTime, onupdate=datetime.now)\n name = sa.Column(sa.Unicode(75), nullable=False, unique=True)\n reg_num = sa.Column(sa.Integer, nullable=False, unique=True)\n status = sa.Column(sa.Unicode(15), nullable=False, default=u'active', server_default=u'active')\n\n # VALIDATION\n STATUS_CHOICES = (\n ('active', 'Active'),\n ('inactive', 'Inactive'),\n ('moved', 'Moved'),\n )\n # will validate nullability and string types\n val.validates_constraints()\n val.validates_one_of('status', [k for k, v in STATUS_CHOICES])\n\n #OTHER\n def __str__(self):\n return '' % (self.id, self.name)\n\n class Person(Base, ValidationMixin):\n __tablename__ = 'people'\n\n id = sa.Column(sa.Integer, primary_key=True)\n createdts = sa.Column(sa.DateTime, nullable=False, server_default=sasql.text('CURRENT_TIMESTAMP'))\n updatedts = sa.Column(sa.DateTime, onupdate=datetime.now)\n name_first = sa.Column(sa.Unicode(75), nullable=False)\n name_last = sa.Column(sa.Unicode(75), nullable=False)\n family_role = sa.Column(sa.Unicode(20), nullable=False)\n nullable_but_required = sa.Column(sa.Unicode(5))\n\n ROLE_CHOICES = (\n ('father', 'Father'),\n ('mother', 'Mother'),\n ('child', 'Child'),\n )\n val.validates_constraints(exclude='createdts')\n val.validates_presence_of('nullable_but_required')\n val.validates_choices('family_role', ROLE_CHOICES)\n\n class ReverseConverter(formencode.api.FancyValidator):\n def _to_python(self, value, state):\n if not isinstance(value, basestring):\n raise formencode.Invalid('Must be a string type', value, state)\n # this reverse a string or list...yah, I know, it looks funny\n return value[::-1]\n\n validates_reverse = val.formencode_factory(ReverseConverter)\n converts_reverse = val.formencode_factory(ReverseConverter, sv_convert=True)\n\n class ConversionTester(Base, ValidationMixin):\n __tablename__ = 'conversion_testers'\n\n id = sa.Column(sa.Integer, primary_key=True)\n val1 = sa.Column(sa.String(25))\n val2 = sa.Column(sa.String(25))\n val3 = sa.Column(sa.String(25))\n val4 = sa.Column(sa.String(25))\n\n validates_reverse('val1')\n validates_reverse('val2', sv_convert=True)\n converts_reverse('val3')\n converts_reverse('val4', sv_convert=False)\n\nSee more examples in the tests directory of the distribution.\n\nInstalling & Testing Source\n---------------------------\n\n(this is one way, there are others)\n\n.. code-block:: bash\n\n # create a virtualenv\n # activate the virtualenv\n\n $ pip install -e git+git://github.com/blazelibs/sqlalchemy-validation.git@master#egg=savalidation\n $ pip install nose\n $ cd src/savalidation/savalidation\n $ nosetests\n\nQuestions & Comments\n--------------------\n\nPlease visit: http://groups.google.com/group/blazelibs\n\nKnown Issues\n------------\n\nFinal values that get set on an ORM mapped object attributes through\nrelationships, the default or onupdate column parameters, and possibly others\nare not availble at the time validation is done.\n\nIn some cases, this can be caught after the flush (before commit) when those\nvalues become available on the ORM object.\n\nUnfortunately, that is of limited value in the case where the the value that\nslipped through violates a DB constraint. In that case, a true DB exception\nwill be raised.\n\nDependencies\n------------\n\n* SQLAlchemy > 0.7.6\n* FormEncode\n* python-dateutil (for date/time converters)\n* Nose (if you want to run the tests)\n\nCredits\n-------\n\nThis project borrows code and ideas from:\n\n* `Sqlalchemy Validations `_\n* `Elixir `_\n\nCurrent Status\n--------------\n\nThe code itself seems stable, but the API may change in the future.\n\n\nChange Log\n----------\n\n\n0.4.1 released 2016-11-23\n=========================\n\n* fixed Python versions listed for package\n* fixed a broken link in the readme to the Elixir project\n* updated CircleCI setup and added AppVeyor\n\n0.4.0 released 2016-06-10\n=========================\n\n* added support for Python 3.4+ (thanks to Ji\u0159\u00ed Bire\u0161)\n* set up continuous integration on Circle CI\n* coverage reports through CodeCov\n\n0.3.2 released 2016-04-20\n=========================\n\n* validate precision and scale of numeric column values\n\n0.3.1 released 2016-02-23\n=========================\n\n* fix formencode compatibility, supports formencode 1.2 and 1.3\n\n0.3.0 released 2014-09-30\n=========================\n\n* fix bug with .validates_constraints() and Text column types\n* watch_session() is no longer needed, SQLAlchemy >= 0.7.6 required\n* now beta quality: been used in production a long time, but not used widely\n\n0.2.1 released 2013-05-15\n=========================\n\n* fixed issue #6 - adjustment to the version of python-dateutil required.\n\n0.2.0 released 2012-10-24\n=========================\n\nThis release contains some **BC BREAKS**.\n\n* internal API cleaned up\n* refactored to use SQLAlchemy (SA) events, we are now compatable with & require\n SA >= 0.7\n* CHANGE: if using SA < 0.7.6, savalidation.watch_session() must be called with each\n instance of your session IF the savalidation module is being instantiated\n before your session is created.\n* CHANGE: the validator API has changed. If you have created custom validators\n you will need to look at the changes in validators.py.\n* the Formencode state object sent to a validator's method has changed the\n \"instance\" attribute to be \"entity.\"\n* add before_flush() helper to decorate entity instance methods\n* got rid of after_flush validation. Instead, before_insert/before_update events\n can now be used to validate non-nullable foreign keys.\n* got rid of validation support for a column's default and server_default\n values (b/c it required after_flush validation)\n* formencode schemas are now only created once per class, not per instance,\n boosting performance.\n\n0.1.5 released 2011-06-11\n=========================\n\n* fix 0.1.4 release which didn't include version file\n\n0.1.4 released 2011-06-11\n=========================\n\n* change python-dateutil dependence to < 2.0, 2.x is for python 3\n\n0.1.3 released 2011-05-19\n=========================\n\n* change SQLAlchemy requirement so the latest package < 0.7 is installed", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/blazelibs/sqlalchemy-validation", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "SAValidation", "package_url": "https://pypi.org/project/SAValidation/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/SAValidation/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/blazelibs/sqlalchemy-validation" }, "release_url": "https://pypi.org/project/SAValidation/0.4.1/", "requires_dist": null, "requires_python": null, "summary": "Active Record like validation on SQLAlchemy declarative model objects", "version": "0.4.1" }, "last_serial": 4622860, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "67454df7ce21a8cabc914bc5a02b0642", "sha256": "1bc9a2f0bee8f1fa1431206b0cc362baf04d92cf9a67a6cb4a8a4757a958e2e0" }, "downloads": -1, "filename": "SAValidation-0.1-py2.6.egg", "has_sig": false, "md5_digest": "67454df7ce21a8cabc914bc5a02b0642", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 15405, "upload_time": "2010-11-16T01:42:50", "url": "https://files.pythonhosted.org/packages/85/d8/b92eeff37f3a2c66dbde04a2f1c2884674f34eb609f90ccfe138dae85307/SAValidation-0.1-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "c9c44e9ef3fe8168b4b623e174829d39", "sha256": "c9185f5ca46b88bccc79cde4360c1c0fd00a19991627b6ecc9beddd56731fddb" }, "downloads": -1, "filename": "SAValidation-0.1.tar.gz", "has_sig": false, "md5_digest": "c9c44e9ef3fe8168b4b623e174829d39", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6080, "upload_time": "2010-11-16T01:42:49", "url": "https://files.pythonhosted.org/packages/b2/a6/ca6b7ed9310afd891899c31bf6ba748841ce5d54aa1594a2c5166a0f539f/SAValidation-0.1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "d98b2e95864445fdd4925754dfc04195", "sha256": "49de81379580a2addf987cf0cc705420d08990f253465791b8f42e072ac4b8e3" }, "downloads": -1, "filename": "SAValidation-0.1.1-py2.6.egg", "has_sig": false, "md5_digest": "d98b2e95864445fdd4925754dfc04195", "packagetype": "bdist_egg", "python_version": "2.6", "requires_python": null, "size": 15794, "upload_time": "2010-11-24T22:31:03", "url": "https://files.pythonhosted.org/packages/98/7a/927545ee0c89c1e2dc5fa166884017197e90bbac3c825081ff7f61d4405e/SAValidation-0.1.1-py2.6.egg" }, { "comment_text": "", "digests": { "md5": "1f1e7b8a8cdb01fbbd38d6e2133b450b", "sha256": "fafcc119865a8c1c7fea23842910eb07bd0eb70569592741e248a9a20c3f997a" }, "downloads": -1, "filename": "SAValidation-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1f1e7b8a8cdb01fbbd38d6e2133b450b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6238, "upload_time": "2010-11-24T22:31:02", "url": "https://files.pythonhosted.org/packages/d5/b2/08f2c498d6ed96d73e111700352d61127a95b434a465b049cef481e015b9/SAValidation-0.1.1.tar.gz" } ], "0.1.2": [], "0.1.3": [ { "comment_text": "", "digests": { "md5": "cb0301c3b4a666825526929cbdb57924", "sha256": "11a7c7db8cb30243ade7d39691feda1914d198965b52ea1701637e71573fd906" }, "downloads": -1, "filename": "SAValidation-0.1.3.tar.gz", "has_sig": false, "md5_digest": "cb0301c3b4a666825526929cbdb57924", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7986, "upload_time": "2011-05-19T23:28:13", "url": "https://files.pythonhosted.org/packages/bc/13/6fcddd41eaa4c164c1f8af4bdbde4c0a7f3095b96308ea7f4a80745858de/SAValidation-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "dadc7f0d6cabd61b9dc4d286667dc32d", "sha256": "166d8186d086116734a8b61c34ea18bd7a176f1c3a07d5e019e467f1b656f9ef" }, "downloads": -1, "filename": "SAValidation-0.1.4.tar.gz", "has_sig": false, "md5_digest": "dadc7f0d6cabd61b9dc4d286667dc32d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13161, "upload_time": "2011-06-12T06:18:02", "url": "https://files.pythonhosted.org/packages/b3/41/36a8a77f18c814d6c2284ebde02227053f3d53d26326416d735328445c91/SAValidation-0.1.4.tar.gz" } ], "0.1.5": [ { "comment_text": "", "digests": { "md5": "b5962bd9ee2fd01632b1c1f06ac91353", "sha256": "7b89f61a309a8efa13dd4ec2f2b3aaa1c3ba46ad1eec268241d7f46476e344f2" }, "downloads": -1, "filename": "SAValidation-0.1.5.tar.gz", "has_sig": false, "md5_digest": "b5962bd9ee2fd01632b1c1f06ac91353", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13184, "upload_time": "2011-06-12T08:20:44", "url": "https://files.pythonhosted.org/packages/80/b0/b80185b9625e73844a3f63491a13921d5b40c91322d3f5abe7dda896881e/SAValidation-0.1.5.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "2e3cc671b1fffdda1ab4e9ffd9825955", "sha256": "03691986fce335d092a45a1c1ba8444f92612aa2680262b5f5b9a3ea4076ea0d" }, "downloads": -1, "filename": "SAValidation-0.2.0.tar.gz", "has_sig": false, "md5_digest": "2e3cc671b1fffdda1ab4e9ffd9825955", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18026, "upload_time": "2012-10-24T22:12:32", "url": "https://files.pythonhosted.org/packages/43/5c/968d71862ffa8e9500fde8300cb571d168183bb3e154114a03dcf512d312/SAValidation-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "3a72d9c86f0014be37b906f598f11780", "sha256": "85217d40daaa3b667115dcb79fe95f5649ffa8ccbbc744444d16c96fa35dd84e" }, "downloads": -1, "filename": "SAValidation-0.2.1.tar.gz", "has_sig": false, "md5_digest": "3a72d9c86f0014be37b906f598f11780", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18128, "upload_time": "2013-05-16T01:40:15", "url": "https://files.pythonhosted.org/packages/ca/e0/ca7748e77f0d580fec70283611e0f8d9791dcf59401bca17e44d29a53606/SAValidation-0.2.1.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "d61d1d61708bb02ad736750f80260eda", "sha256": "9bfc39d20678884ffa366e73d60ba383478a73aa4308d3e53a8dadfce90c4b90" }, "downloads": -1, "filename": "SAValidation-0.3.0.tar.gz", "has_sig": false, "md5_digest": "d61d1d61708bb02ad736750f80260eda", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17987, "upload_time": "2014-09-30T21:26:52", "url": "https://files.pythonhosted.org/packages/9c/f0/c2292f67ba8e9c469d5497bf4526bb0128b8903945e4e5f47faa75ae64dc/SAValidation-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "a5b9fb5c87c54574d53a3f5f1f978c19", "sha256": "259a798c9f6338eb573d0ab41ad7b8bcd2981390ec81a3b20b4afeeb93d4d0bb" }, "downloads": -1, "filename": "SAValidation-0.3.1.zip", "has_sig": false, "md5_digest": "a5b9fb5c87c54574d53a3f5f1f978c19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 27937, "upload_time": "2016-02-24T01:40:15", "url": "https://files.pythonhosted.org/packages/ce/12/0c409373408c043088d7b88cfcb3f50b9c813f4f47c34c40ba816c0115f2/SAValidation-0.3.1.zip" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "477f6df6fa293496abc17e563a240398", "sha256": "a945cf6d4e4db93c3137e6ec81f611e71df4922e9f4592828212c38c10ca56f6" }, "downloads": -1, "filename": "SAValidation-0.3.2.tar.gz", "has_sig": false, "md5_digest": "477f6df6fa293496abc17e563a240398", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18498, "upload_time": "2016-04-20T14:10:32", "url": "https://files.pythonhosted.org/packages/3d/1a/6cc66a5cd5c102a57d0726a5371347b96c42afce1b0a5f766e2d2bf6bb5e/SAValidation-0.3.2.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "b58682961ec3f5d7aacf478674d76162", "sha256": "9384d1b1db0531b42c58b9c2282f52745af36ca05b4621d68bee7f9b89811640" }, "downloads": -1, "filename": "SAValidation-0.4.0.tar.gz", "has_sig": false, "md5_digest": "b58682961ec3f5d7aacf478674d76162", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19333, "upload_time": "2016-06-10T14:49:34", "url": "https://files.pythonhosted.org/packages/68/54/d87fa61a9443380b50e6bfd985c9eb0e476f7777b748cbe90385f5795410/SAValidation-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "d9d5b63ec74b63d13dca8d9c9c532d10", "sha256": "2a91bb2977f69856f2c91fbc1b856bb3d1b399f36a7a5f0b7b12570e4d606bce" }, "downloads": -1, "filename": "SAValidation-0.4.1.tar.gz", "has_sig": false, "md5_digest": "d9d5b63ec74b63d13dca8d9c9c532d10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19572, "upload_time": "2016-11-23T20:15:13", "url": "https://files.pythonhosted.org/packages/77/b9/b88e840e46266c99b3a35cfe77272302b6023ee2fa3d2d408ca873268b72/SAValidation-0.4.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d9d5b63ec74b63d13dca8d9c9c532d10", "sha256": "2a91bb2977f69856f2c91fbc1b856bb3d1b399f36a7a5f0b7b12570e4d606bce" }, "downloads": -1, "filename": "SAValidation-0.4.1.tar.gz", "has_sig": false, "md5_digest": "d9d5b63ec74b63d13dca8d9c9c532d10", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19572, "upload_time": "2016-11-23T20:15:13", "url": "https://files.pythonhosted.org/packages/77/b9/b88e840e46266c99b3a35cfe77272302b6023ee2fa3d2d408ca873268b72/SAValidation-0.4.1.tar.gz" } ] }