{ "info": { "author": "Zope Corporation and Contributors", "author_email": "zope-dev@zope.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Web Environment", "Framework :: Zope3", "Intended Audience :: Developers", "License :: OSI Approved :: Zope Public License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Internet :: WWW/HTTP" ], "description": "There are two types of widgets provided by this package, a date widget\nand a datetime widget.\n\n\n.. contents::\n\n=========================\nDatetime and Date Widgets\n=========================\n\nThere are two types of widgets provided by this package, a date widget\nand a datetime widget.\n\nDate Widget\n-----------\n\nThe date widget only handles datetime.date objects, which are not\ntimezone aware. We use the demo package here to have a content class.\n\n >>> from zope import component\n >>> from datetime import datetime, date\n >>> from zc.datetimewidget import datetimewidget\n >>> from zc.datetimewidget.demo.content import DemoContent\n >>> from zc.datetimewidget.demo.interfaces import IDemoContent\n >>> from zope.publisher.browser import TestRequest, BrowserLanguages\n >>> component.provideAdapter(BrowserLanguages)\n >>> request = TestRequest(HTTP_ACCEPT_LANGUAGE='en-US')\n >>> field = IDemoContent['startDate']\n >>> widget = datetimewidget.DateWidget(field,request)\n >>> widget._toFormValue(None)\n u''\n\nNow let us convert a real date.\n\n >>> d = date(2006,5,1)\n >>> formValue = widget._toFormValue(d)\n >>> formValue\n '2006-05-01'\n\n >>> parsedValue = widget._toFieldValue(formValue)\n >>> parsedValue\n datetime.date(2006, 5, 1)\n\nThe widget handles the same date notations as zope's default datewidget.\n\n >>> widget._toFieldValue('2006/12/31')\n datetime.date(2006, 12, 31)\n\nDatetime Widget\n---------------\n\nDatetimes are always stored timezone aware, and by default the utc\ntimezone is used.\n\nIn order to handle timezones correctly the zope instance has to\nprovide an adapter from IBrowserRequest to ITZInfo. It is up to the\ninstance what kind of implementation it uses. For this test, we just\nuse the implementation of the demo.timezone module which always\nreturns Europe/Vienna as timezone.\n\nThe field's missing value results in an empty string.\n\n >>> import pytz\n >>> from zc.datetimewidget.demo import timezone\n >>> component.provideAdapter(timezone.tzinfo)\n >>> tz = pytz.timezone('Europe/Vienna')\n >>> request = TestRequest(HTTP_ACCEPT_LANGUAGE='en-US')\n >>> field = IDemoContent['startDatetime']\n >>> widget = datetimewidget.DatetimeWidget(field,request)\n\n >>> widget._toFormValue(None)\n u''\n\nNow let us convert a real datetime.\n\n >>> dt = datetime(2006,5,1,12,tzinfo=pytz.utc)\n >>> formValue = widget._toFormValue(dt)\n >>> formValue\n '2006-05-01 14:00:00'\n >>> parsedValue = widget._toFieldValue(formValue)\n >>> parsedValue\n datetime.datetime(2006, 5, 1, 12, 0, tzinfo=)\n\n\nThe datetime might also be an naive one (without time zone) but it\ngets saved with UTC timezone information.\n\n >>> naive_dt = datetime(2006,5,1,12)\n >>> formValue = widget._toFormValue(naive_dt)\n >>> formValue\n '2006-05-01 12:00:00'\n >>> parsedValue = widget._toFieldValue(formValue)\n >>> parsedValue\n datetime.datetime(2006, 5, 1, 10, 0, tzinfo=)\n\n\nWhile the widget tries to parse dates in the form '%Y-%m-%d %H:%M:%S'\nfirst, it will fall through to the locale-specific parsing of the core\ndatetimewidget.\n\n >>> widget._toFieldValue('May 1, 2006 2:00:00 PM')\n datetime.datetime(2006, 5, 1, 12, 0, tzinfo=)\n\n\n\n===============\nCalendar Widget\n===============\n\n\nConfiguration\n-------------\n\n >>> from zope.interface.verify import verifyObject\n >>> from zc.datetimewidget.datetimewidget import (\n ... CalendarWidgetConfiguration, ICalendarWidgetConfiguration)\n\nLet's create a standard configuration object:\n\n >>> conf = CalendarWidgetConfiguration('field.x')\n >>> verifyObject(ICalendarWidgetConfiguration, conf)\n True\n\nFields have their default values:\n\n >>> conf.daFormat\n u'%Y/%m/%d'\n >>> conf.singleClick\n True\n >>> print conf.flat\n None\n\nWe can customize some attributes during instantiation:\n\n >>> import datetime\n >>> conf = CalendarWidgetConfiguration('x', date=datetime.date(2006, 8, 25))\n >>> conf.date\n datetime.date(2006, 8, 25)\n\n\nDumping JavaScript\n------------------\n\nConfiguration can be dumped as JavaScript. First an empty configuration:\n\n >>> print CalendarWidgetConfiguration('field.x').dumpJS()\n Calendar.setup({\n \n });\n\nNow let's add a few customizations:\n\n >>> conf = CalendarWidgetConfiguration('x', daFormat=u'%m-%d',\n ... inputField='inp', eventName=None, date=conf.date)\n >>> print conf.dumpJS()\n Calendar.setup({\n inputField: 'inp',\n eventName: null,\n daFormat: '%m-%d',\n date: new Date(2006, 7, 25)\n });\n\nInvalid arguments are not accepted:\n\n >>> conf = CalendarWidgetConfiguration('x', foo='bar')\n Traceback (most recent call last):\n ...\n ValueError: unknown arguments: foo\n\n\nDate set widget\n---------------\n\n >>> from zc.datetimewidget.datetimewidget import DateSetWidget\n >>> from zope.schema import Set\n >>> from zope.publisher.browser import TestRequest\n\n >>> class Context(object):\n ... somedates = set()\n >>> context = Context()\n\n >>> request = TestRequest()\n >>> field = Set(__name__='somedates')\n >>> field.set(context, set([datetime.date(2006, 12, 6),\n ... datetime.date(2006, 12, 7)]))\n >>> field = field.bind(context)\n >>> widget = DateSetWidget(field, object(), request)\n\n >>> print widget() # doctest: +REPORT_NDIFF\n \n \n \n \n \n\n >>> print widget.hidden() # doctest: +REPORT_NDIFF\n \n \n \n\n\n\n====================\nDatetime Widget Demo\n====================\n\nThis demo packe provides a simple content class which uses the\nzc.datetimewidget\n\n >>> from zope.testbrowser.testing import Browser\n >>> browser = Browser()\n >>> browser.handleErrors = False\n >>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')\n >>> browser.open('http://localhost/@@contents.html')\n\nIt can be added by clicking on the \"Datetimewidget Demo\" link in the\nadd menu. And giving it a name.\n\n >>> link = browser.getLink('Datetimewidget Demo')\n >>> link.click()\n >>> nameCtrl = browser.getControl(name='new_value')\n >>> nameCtrl.value = 'mydemo'\n >>> applyCtrl = browser.getControl('Apply')\n >>> applyCtrl.click()\n >>> link = browser.getLink('mydemo')\n >>> link.click()\n >>> browser.url\n 'http://localhost/mydemo/@@edit.html'\n\nWe can fill in the values\n\n >>> browser.getControl('Start Date').value = '2006-11-15'\n >>> browser.getControl('End Date').value = '2006-11-16'\n >>> browser.getControl('Start Datetime').value = '2006-11-15T07:49:31Z'\n >>> browser.getControl('End Datetime').value = '2006-11-16T19:46:00Z'\n >>> browser.getControl('Several dates').value = '2006-11-20 2006-11-21 2006-11-22'\n >>> browser.getControl('Change').click()\n\nAnd they will be saved:\n\n >>> 'Required input is missing' in browser.contents\n False\n\n >>> '2006-11-15' in browser.contents\n True\n >>> '2006-11-16' in browser.contents\n True\n >>> '07:49' in browser.contents\n True\n >>> '19:46' in browser.contents\n True\n >>> '2006-11-20 2006-11-21 2006-11-22' in browser.contents\n True\n\nIf we do not fill some fields, we get missing value errors\n\n >>> browser.getControl('Start Date').value = ''\n >>> browser.getControl('Change').click()\n >>> 'Required input is missing' in browser.contents\n True\n\nLet's step back:\n\n >>> browser.getControl('Start Date').value = '2006-11-15'\n >>> browser.getControl('Change').click()\n >>> 'Required input is missing' in browser.contents\n False\n\nNow let's try not filling a date set field:\n\n >>> browser.getControl('Several dates').value = ''\n >>> browser.getControl('Change').click()\n >>> 'Required input is missing' in browser.contents\n True\n\n\n\n=======\nCHANGES\n=======\n\n0.8.0 (2016-01-12)\n------------------\n\n- Get rid of the ``zope.app.form`` dependency by using ``zope.formlib``\n >= 4.0.\n\n\n0.7.0 (2011-06-07)\n------------------\n\n- Fix tests using a newer zope.publisher that requires zope.login.\n- Fix tests by not using deprecated ``zope.app.securitypolicy``\n- Remove test dependency ``zope.app.server`` and ``zope.app.authentication``.\n Use ``zope.password`` instead.\n- No longer using deprecated ``zope.testing.doctestunit``. Use python's\n build-in ``doctest`` instead.\n\n\n0.6.4 (2009-10-20)\n------------------\n\n- Make Calendar pop-up and drag behavior more consistent across\n browser modes in IE.\n\n\n0.6.3 (2009-08-24)\n------------------\n\n- Fixed handling of naive datetime objects, they no longer result in\n an exception but are displayed unchanged. When they get saved again\n they are saved with UTC timezone like all other ones.\n\n- Added `datetimewidget.txt` doctest to ``long_description`` to show\n up on pypi home page.\n\n- Fixed home page name in `setup.py`.\n\n- Added coverage analysis tools to buildout.\n\n- Removed deprecated zpkg and zcml slugs.\n\n\n0.6.2 (2009-05-20)\n------------------\n\n- Using `++resource++` instead of `@@/` to load resources.\n\n- Renaming \"lang\" directory (``ZPublisher`` gets confused because of a\n view with the same name exists in ``zope.traversing.namespace``).\n\n See `gocept.datetimewidget`_ for more details on how to use\n zc.datetimewidget with zope2.\n\n.. _`gocept.datetimewidget` : http://pypi.python.org/pypi/gocept.datetimewidget\n\n0.6.1 (2008-05-29)\n------------------\n\n- Unchanged from 0.5.2, but released with a new version number thanks to a\n package with an 0.6.1dev-rBFN revision found in the wild.\n\n0.5.2 (2007-11-03)\n------------------\n\n- Improve package data.\n\n- Developed proper package dependencies.\n\n- Merged functional tests into ``tests.py``.\n\n0.5.1 (2006-06-15)\n------------------\n\n- Include license and copyright headers.\n\n0.5.0 (2006-05-24)\n------------------\n\n- Initial release.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://pypi.python.org/pypi/zc.datetimewidget", "keywords": "zope3 date datetime widget javascript", "license": "ZPL 2.1", "maintainer": "", "maintainer_email": "", "name": "zc.datetimewidget", "package_url": "https://pypi.org/project/zc.datetimewidget/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/zc.datetimewidget/", "project_urls": { "Homepage": "http://pypi.python.org/pypi/zc.datetimewidget" }, "release_url": "https://pypi.org/project/zc.datetimewidget/0.8.0/", "requires_dist": null, "requires_python": "", "summary": "Javascript-based widgets for date and datetime fields.", "version": "0.8.0" }, "last_serial": 1900585, "releases": { "0.5.2": [ { "comment_text": "", "digests": { "md5": "4359d87ecd524ee9aaee15233cd2335f", "sha256": "0def943ab1eaf9a3721948747e0ba83b01301dc092deb8442061cfbfc5f1680e" }, "downloads": -1, "filename": "zc.datetimewidget-0.5.2.tar.gz", "has_sig": false, "md5_digest": "4359d87ecd524ee9aaee15233cd2335f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 48780, "upload_time": "2007-11-03T17:59:34", "url": "https://files.pythonhosted.org/packages/49/81/22e62dea188515467eb63c93457bc65661466ed986a464471ffe90da15da/zc.datetimewidget-0.5.2.tar.gz" } ], "0.6.1": [ { "comment_text": "", "digests": { "md5": "7586075e69de7bf620b14d67c8afcf72", "sha256": "679d385b10e6e9913081dd57ab9fef1398474ea8407b06bffcf4195b1b7b7e40" }, "downloads": -1, "filename": "zc.datetimewidget-0.6.1.tar.gz", "has_sig": false, "md5_digest": "7586075e69de7bf620b14d67c8afcf72", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51629, "upload_time": "2008-05-29T04:15:52", "url": "https://files.pythonhosted.org/packages/59/db/b0243ab54e07934bc5e574008af67ec3e9b5b6ec70dccec0e6e8cc43dca1/zc.datetimewidget-0.6.1.tar.gz" } ], "0.6.2": [ { "comment_text": "", "digests": { "md5": "e0efb7c62a34b02a041fa285f1ecb49c", "sha256": "c5eb3aa878ddd35306398acb17c61b50ee21eddde2807dd5ec2c9727b78a8752" }, "downloads": -1, "filename": "zc.datetimewidget-0.6.2.tar.gz", "has_sig": false, "md5_digest": "e0efb7c62a34b02a041fa285f1ecb49c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51951, "upload_time": "2009-05-20T12:46:50", "url": "https://files.pythonhosted.org/packages/d1/6a/f3d5cc730637b0ab16081ba1c63d1d8a8f678795e6c46006d3e042ca811a/zc.datetimewidget-0.6.2.tar.gz" } ], "0.6.3": [ { "comment_text": "", "digests": { "md5": "3b30871eeb00a4a7502ebd4b6fea0c4d", "sha256": "50bc1b42cc71a04229d5409de77e95e0c02f7497d40328a0b26516ea473854d1" }, "downloads": -1, "filename": "zc.datetimewidget-0.6.3.tar.gz", "has_sig": false, "md5_digest": "3b30871eeb00a4a7502ebd4b6fea0c4d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 54130, "upload_time": "2009-08-24T12:08:06", "url": "https://files.pythonhosted.org/packages/65/22/79cb13af1b90c38d661a737246cd442f4433dd78e753417bf171042ce8e9/zc.datetimewidget-0.6.3.tar.gz" } ], "0.6.4": [ { "comment_text": "", "digests": { "md5": "98605bca26cd6aa84ed6379fba226c16", "sha256": "d353bc92a13a359a5a6d693ecf11ca47743fa941758e65339878cde9f3e5d7f6" }, "downloads": -1, "filename": "zc.datetimewidget-0.6.4.tar.gz", "has_sig": false, "md5_digest": "98605bca26cd6aa84ed6379fba226c16", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51461, "upload_time": "2009-10-20T22:15:31", "url": "https://files.pythonhosted.org/packages/6b/35/de4eded72bd4a7bd9800e33a4cd97da66fdca3dd1ba7e1297e0458c4d4db/zc.datetimewidget-0.6.4.tar.gz" } ], "0.7.0": [ { "comment_text": "", "digests": { "md5": "cfb12768d4d55134e8be3f4ceef7d2ca", "sha256": "0fe2358a5511c2708e3c330e0aa0bf1a217d317417026175d2d95ba276177a69" }, "downloads": -1, "filename": "zc.datetimewidget-0.7.0.tar.gz", "has_sig": false, "md5_digest": "cfb12768d4d55134e8be3f4ceef7d2ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 57123, "upload_time": "2011-06-07T17:24:14", "url": "https://files.pythonhosted.org/packages/55/30/3f2d516320f2a64e6ed3b3303d9180f46315d471ce9104e102554ee2f173/zc.datetimewidget-0.7.0.tar.gz" } ], "0.8.0": [ { "comment_text": "", "digests": { "md5": "25e6c79de29530797092cbfe7c9cf184", "sha256": "f6627a62bfb5fd5c55d1e076100f91d2a80e24869dd97dcbfa909a6a91b66577" }, "downloads": -1, "filename": "zc.datetimewidget-0.8.0.tar.gz", "has_sig": false, "md5_digest": "25e6c79de29530797092cbfe7c9cf184", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 54753, "upload_time": "2016-01-12T10:30:18", "url": "https://files.pythonhosted.org/packages/a1/32/05acfd667c7670ded21287f4ad327d93c704d2d27b765e178c7c7e7794c0/zc.datetimewidget-0.8.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "25e6c79de29530797092cbfe7c9cf184", "sha256": "f6627a62bfb5fd5c55d1e076100f91d2a80e24869dd97dcbfa909a6a91b66577" }, "downloads": -1, "filename": "zc.datetimewidget-0.8.0.tar.gz", "has_sig": false, "md5_digest": "25e6c79de29530797092cbfe7c9cf184", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 54753, "upload_time": "2016-01-12T10:30:18", "url": "https://files.pythonhosted.org/packages/a1/32/05acfd667c7670ded21287f4ad327d93c704d2d27b765e178c7c7e7794c0/zc.datetimewidget-0.8.0.tar.gz" } ] }