{ "info": { "author": "Nikolay Kim", "author_email": "fafhrd91@gmail.com", "bugtrack_url": null, "classifiers": [ "Framework :: Pyramid", "Intended Audience :: Developers", "Programming Language :: Python", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: Implementation :: CPython" ], "description": "pform\n=====\n\n.. image :: https://travis-ci.org/fafhrd91/pform.png\n :target: https://travis-ci.org/fafhrd91/pform\n\n\nSimple form example\n-------------------\n\nForm contains three different subsystems, basic form attributes, fields and actions.\n\n.. code-block:: python\n\n import pform\n from pyramid.httpexceptions import HTTPFound\n\n\n class EditForm(pform.Form):\n\n label = 'Edit form'\n\n fields = pform.Fieldset(\n pform.TextField(\n 'name', title='Name')\n )\n\n @pform.button('Save')\n def safe_handler(self):\n data, errors = self.extract()\n\n if errors:\n self.add_error_message(errors)\n\n self.context.name = data['name']\n\n @pform.button('Cancel')\n def cancel_handler(self):\n return HTTPFound(location='.')\n\nThis form renders one field `name` and two actions `safe` and `cancel` (submit buttons). Now we can render this form:\n\n.. code-block:: python\n\n from pyramid.view import view_config\n\n @view_config(route_name='....', renderer='myview.jinja2')\n def my_view(request):\n form = EditForm(some_context, request)\n return form()\n\nalso it is possible to use form class as view:\n\n.. code-block:: python\n\n @view_config(route_name='....')\n class EditForm(pform.Form):\n\n fields = ...\n\n\nTo do additional custom form initialization just override `update` method, also\nif `update` method returns dictionary this values bypasses to form template:\n\n.. code-block:: python\n\n class EditForm(pform.Form):\n\n def update(self):\n # custom form initialization\n return {some_data: some_value}\n\n\nTo get form values use `extract` method, this method return\n`data` and `errors`. `data` is a form result, `errors` is a list of errors:\n\n.. code-block:: python\n\n class EditForm(pform.Form):\n\n @pform.button('Save')\n def save_handler(self):\n data, errors = self.extract()\n\n if errors:\n self.add_error_message(errors)\n\n # save data\n ...\n\n\nCustomization\n-------------\n\nThere are two ways for field and form customization:\n\n1. Global customization \n\n `pform` library uses `player`::https://github.com/fafhrd91/pform/tree/master/examples library for customization. `pform` libriary defines layer category `form` for all templates.\n\n\n2. Field/form customization\n\n Also it is possible to customize widget of input template for each field. You can pass ``tmpl_widget`` argument to to field constructor for widget customization and ``tmpl_input`` argument for input generation. Both arguments should be valid pyramid renderer path.\n Form accepts three different templates, ``tmpl_view``, ``tmpl_actions`` and ``tmpl_widget``. ``tmpl_view`` is form renderer, ``tmpl_actions`` if form buttons renderer, ``tmpl_widget`` is custom field widget renderer. If field does not use custom ``tmpl_widget`` then form automatically sets ``tmpl_widget`` for each of this fields.\n\n\nExamples\n--------\n\nThere are several example. You can find them in the `examples` directory at github.\n\nhttps://github.com/fafhrd91/pform/tree/master/examples\n\n\nRequirements\n------------\n\n- Python 2.6+ or Python 3.2+\n\n- virtualenv\n\n\n\nLicense\n-------\n\npform is offered under the BSD license.\n\nCHANGES\n=======\n\n\n0.6.2 (01-16-2013)\n------------------\n\n- Fixed composite and options templates for Chrome\n\n\n0.6.1 (01-09-2012)\n------------------\n\n- Allow return additional data from action handler\n\n- Pass different context to vocabulary factory \n (depends on factory argument name: request, content, context)\n\n\n0.6 (01-07-2013)\n----------------\n\n- Added `OptionsField`\n\n- BaseMultiChoiceField.missing value is [] by default\n\n- Copy field missing value during fieldset data extraction\n\n- Fixed form csrf support\n\n- Fixed 'checked' value for radio field\n\n- Do not use missing value if value is not validation\n\n\n0.5 (12-21-2012)\n----------------\n\n- Added `flat` attribute to field and fieldset, \n with flat fieldset and composite field uses primary data \n dictionary instead of sub dict\n\n\n0.4.1 (12-20-2012)\n------------------\n\n- Fixed FileField validation\n\n\n0.4 (12-12-2012)\n----------------\n\n- Added `Composite` field\n\n- Render str in `form:error` message\n\n- Removed `display` mode\n\n- SimpleTerm and SimpleVocabulary renamed to Term and Vocabulary\n\n- Removed `from_items` and `from_value` SimpleVocabulary methods, \n use Vocabulary constructor instead\n\n- Use `form` layer category for form and field templates\n\n- Button class now inherits from InputField\n\n\n0.3 (11-27-2012)\n----------------\n\n- Allow to add `str` as error in `Form.validate` method\n\n- Better button handling\n\n- Better tanslations for `Invalid` messages\n\n- Changed arguments order for `Invalid` class contrustor \n\n- Added sub errors support to `Invalid` class\n\n- Added `extract` parameter to `Button` class, if extract is set then action\n extract values from form, adds errors to message and pass data to handler\n\n- Added `pform.button2` decorator, `extract` parameter is true\n\n- Added `max_size` and `allowed_types` parameters to FileField\n\n- Do not override widget's custom tmpl_widget\n\n\n0.2 (11-13-2012)\n----------------\n\n- Fixed submit button template\n\n- Allow to return http response from form update or action handler\n\n- Added support for `player.layout()`\n\n\n0.1 (11-07-2012)\n----------------\n\n- Initial release", "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/fafhrd91/pform/", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "pform", "package_url": "https://pypi.org/project/pform/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/pform/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/fafhrd91/pform/" }, "release_url": "https://pypi.org/project/pform/0.6.2/", "requires_dist": null, "requires_python": null, "summary": "Form generation library for Pyramid framework", "version": "0.6.2" }, "last_serial": 796192, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "06608c879829a52daadacdec7485d6a9", "sha256": "5a34f058dc691f1f9415c37a1ce2249be19345bf4f0dd7a16f1fd4beff4596c5" }, "downloads": -1, "filename": "pform-0.1.tar.gz", "has_sig": false, "md5_digest": "06608c879829a52daadacdec7485d6a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 32856, "upload_time": "2012-11-08T17:24:53", "url": "https://files.pythonhosted.org/packages/55/ad/1b657d4b152a48d8ce1175fff17d0dc511adc3ab18c02e180fccb617e9a4/pform-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "7232fa4b6fb4dc856474c0a0bf4949a8", "sha256": "a3bc1f4d502e36c8fb88ad2e64f759650ef818ba89a7ad7ac1292f87f8a8a5c4" }, "downloads": -1, "filename": "pform-0.2.tar.gz", "has_sig": false, "md5_digest": "7232fa4b6fb4dc856474c0a0bf4949a8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 31945, "upload_time": "2012-11-13T07:56:46", "url": "https://files.pythonhosted.org/packages/84/ea/550bdb4c021a0b6866f1bd967d6d1fd5a88fed8b48e7c19ca7cdf7373c74/pform-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "7900fb9ad333c669934248842168e401", "sha256": "02df36ae7cbf9c8d1cdd11b94ead359edd2420521f42054209d8befcd01c8919" }, "downloads": -1, "filename": "pform-0.3.tar.gz", "has_sig": false, "md5_digest": "7900fb9ad333c669934248842168e401", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 36309, "upload_time": "2012-11-28T05:40:46", "url": "https://files.pythonhosted.org/packages/98/de/fbbe91d603814a0f7e5f659352745440ec923f7b2e0710992ab8b8601999/pform-0.3.tar.gz" } ], "0.4": [ { "comment_text": "", "digests": { "md5": "d5d9984e5e09baeff7d0ada63c04ebd6", "sha256": "03ee749452ac3f611c9272585d6c81354aa0bc3cf21190aa3b267062397e63b1" }, "downloads": -1, "filename": "pform-0.4.tar.gz", "has_sig": false, "md5_digest": "d5d9984e5e09baeff7d0ada63c04ebd6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 41970, "upload_time": "2012-12-12T22:46:22", "url": "https://files.pythonhosted.org/packages/5c/2d/b9f92652ff80c0cf1be4e476d99cb155ee8796bcae744fc3ed52b7446cf0/pform-0.4.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "107ad583d6f564163118ca70d44ff359", "sha256": "881d5cf9f5c0b14161e3b4d6a4aa61b9dcea218af408f3129377a6f9753d081c" }, "downloads": -1, "filename": "pform-0.4.1.tar.gz", "has_sig": false, "md5_digest": "107ad583d6f564163118ca70d44ff359", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42204, "upload_time": "2012-12-20T18:59:17", "url": "https://files.pythonhosted.org/packages/98/11/7c61c7473569dc11b81d876832ae6b160542cede858208d5085e8600787c/pform-0.4.1.tar.gz" } ], "0.5": [ { "comment_text": "", "digests": { "md5": "365fbad894d5fc67b15e65055dba549b", "sha256": "8414eb6e209b37b0642da00e6ce7998ff8c5e765c601846b4ef0ecdc67062967" }, "downloads": -1, "filename": "pform-0.5.tar.gz", "has_sig": false, "md5_digest": "365fbad894d5fc67b15e65055dba549b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 42458, "upload_time": "2012-12-21T17:55:12", "url": "https://files.pythonhosted.org/packages/79/e4/5a423b7b8b0f508ce5fe1d82ffee2bee40642ee107793673a8a88478e402/pform-0.5.tar.gz" } ], "0.6": [ { "comment_text": "", "digests": { "md5": "5ce737387b47bd53d5e312c478785b30", "sha256": "b4eb00c3a824f74d9ecd2e6499d8bb7ee7470d197083a103f066f87e63c77bc0" }, "downloads": -1, "filename": "pform-0.6.tar.gz", "has_sig": false, "md5_digest": "5ce737387b47bd53d5e312c478785b30", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45056, "upload_time": "2013-01-07T20:52:25", "url": "https://files.pythonhosted.org/packages/47/a5/161666e4ada678a1b512e4a584fe426211e96a211e9ab941f53afa18ed28/pform-0.6.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "4331fd8a6352abefd01ebf2a33b59bf5", "sha256": "2c5bc9b3f7b9ae5ff212d6899413b672062a615e0cbc7ac9757a3de0b093ec91" }, "downloads": -1, "filename": "pform-0.6.1.tar.gz", "has_sig": false, "md5_digest": "4331fd8a6352abefd01ebf2a33b59bf5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45791, "upload_time": "2013-01-09T10:33:04", "url": "https://files.pythonhosted.org/packages/15/e2/142a3d303a2b92e0d22ea8239707fe173e033a624a0207ca65a6d839234a/pform-0.6.1.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "cb61831fd48e373698a36a654aa189cf", "sha256": "1965df2bc161c3e1b20581b95b521d729961397d64bea026cd6b36081734cc8f" }, "downloads": -1, "filename": "pform-0.6.2.tar.gz", "has_sig": false, "md5_digest": "cb61831fd48e373698a36a654aa189cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45851, "upload_time": "2013-01-17T00:49:11", "url": "https://files.pythonhosted.org/packages/5c/2c/d58208ee05c279712d7ccd0d9aede6694dea9788336e08d146c27ffdec98/pform-0.6.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cb61831fd48e373698a36a654aa189cf", "sha256": "1965df2bc161c3e1b20581b95b521d729961397d64bea026cd6b36081734cc8f" }, "downloads": -1, "filename": "pform-0.6.2.tar.gz", "has_sig": false, "md5_digest": "cb61831fd48e373698a36a654aa189cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45851, "upload_time": "2013-01-17T00:49:11", "url": "https://files.pythonhosted.org/packages/5c/2c/d58208ee05c279712d7ccd0d9aede6694dea9788336e08d146c27ffdec98/pform-0.6.2.tar.gz" } ] }