/usr/share/pyshared/zc.datetimewidget-0.7.0.egg-info/PKG-INFO is in python-zc.datetimewidget 0.7.0-0ubuntu2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | Metadata-Version: 1.1
Name: zc.datetimewidget
Version: 0.7.0
Summary: Javascript-based widgets for date and datetime fields.
Home-page: http://pypi.python.org/pypi/zc.datetimewidget
Author: Zope Corporation and Contributors
Author-email: zope-dev@zope.org
License: ZPL 2.1
Description: There are two types of widgets provided by this package, a date widget
and a datetime widget.
.. contents::
=========================
Datetime and Date Widgets
=========================
There are two types of widgets provided by this package, a date widget
and a datetime widget.
Date Widget
-----------
The date widget only handles datetime.date objects, which are not
timezone aware. We use the demo package here to have a content class.
>>> from zope import component
>>> from datetime import datetime, date
>>> from zc.datetimewidget import datetimewidget
>>> from zc.datetimewidget.demo.content import DemoContent
>>> from zc.datetimewidget.demo.interfaces import IDemoContent
>>> from zope.publisher.browser import TestRequest, BrowserLanguages
>>> component.provideAdapter(BrowserLanguages)
>>> request = TestRequest(HTTP_ACCEPT_LANGUAGE='en-US')
>>> field = IDemoContent['startDate']
>>> widget = datetimewidget.DateWidget(field,request)
>>> widget._toFormValue(None)
u''
Now let us convert a real date.
>>> d = date(2006,5,1)
>>> formValue = widget._toFormValue(d)
>>> formValue
'2006-05-01'
>>> parsedValue = widget._toFieldValue(formValue)
>>> parsedValue
datetime.date(2006, 5, 1)
The widget handles the same date notations as zope's default datewidget.
>>> widget._toFieldValue('2006/12/31')
datetime.date(2006, 12, 31)
Datetime Widget
---------------
Datetimes are always stored timezone aware, and by default the utc
timezone is used.
In order to handle timezones correctly the zope instance has to
provide an adapter from IBrowserRequest to ITZInfo. It is up to the
instance what kind of implementation it uses. For this test, we just
use the implementation of the demo.timezone module which always
returns Europe/Vienna as timezone.
The field's missing value results in an empty string.
>>> import pytz
>>> from zc.datetimewidget.demo import timezone
>>> component.provideAdapter(timezone.tzinfo)
>>> tz = pytz.timezone('Europe/Vienna')
>>> request = TestRequest(HTTP_ACCEPT_LANGUAGE='en-US')
>>> field = IDemoContent['startDatetime']
>>> widget = datetimewidget.DatetimeWidget(field,request)
>>> widget._toFormValue(None)
u''
Now let us convert a real datetime.
>>> dt = datetime(2006,5,1,12,tzinfo=pytz.utc)
>>> formValue = widget._toFormValue(dt)
>>> formValue
'2006-05-01 14:00:00'
>>> parsedValue = widget._toFieldValue(formValue)
>>> parsedValue
datetime.datetime(2006, 5, 1, 12, 0, tzinfo=<UTC>)
The datetime might also be an naive one (without time zone) but it
gets saved with UTC timezone information.
>>> naive_dt = datetime(2006,5,1,12)
>>> formValue = widget._toFormValue(naive_dt)
>>> formValue
'2006-05-01 12:00:00'
>>> parsedValue = widget._toFieldValue(formValue)
>>> parsedValue
datetime.datetime(2006, 5, 1, 10, 0, tzinfo=<UTC>)
While the widget tries to parse dates in the form '%Y-%m-%d %H:%M:%S'
first, it will fall through to the locale-specific parsing of the core
datetimewidget.
>>> widget._toFieldValue('May 1, 2006 2:00:00 PM')
datetime.datetime(2006, 5, 1, 12, 0, tzinfo=<UTC>)
===============
Calendar Widget
===============
Configuration
-------------
>>> from zope.interface.verify import verifyObject
>>> from zc.datetimewidget.datetimewidget import (
... CalendarWidgetConfiguration, ICalendarWidgetConfiguration)
Let's create a standard configuration object:
>>> conf = CalendarWidgetConfiguration('field.x')
>>> verifyObject(ICalendarWidgetConfiguration, conf)
True
Fields have their default values:
>>> conf.daFormat
u'%Y/%m/%d'
>>> conf.singleClick
True
>>> print conf.flat
None
We can customize some attributes during instantiation:
>>> import datetime
>>> conf = CalendarWidgetConfiguration('x', date=datetime.date(2006, 8, 25))
>>> conf.date
datetime.date(2006, 8, 25)
Dumping JavaScript
------------------
Configuration can be dumped as JavaScript. First an empty configuration:
>>> print CalendarWidgetConfiguration('field.x').dumpJS()
Calendar.setup({
<BLANKLINE>
});
Now let's add a few customizations:
>>> conf = CalendarWidgetConfiguration('x', daFormat=u'%m-%d',
... inputField='inp', eventName=None, date=conf.date)
>>> print conf.dumpJS()
Calendar.setup({
inputField: 'inp',
eventName: null,
daFormat: '%m-%d',
date: new Date(2006, 7, 25)
});
Invalid arguments are not accepted:
>>> conf = CalendarWidgetConfiguration('x', foo='bar')
Traceback (most recent call last):
...
ValueError: unknown arguments: foo
Date set widget
---------------
>>> from zc.datetimewidget.datetimewidget import DateSetWidget
>>> from zope.schema import Set
>>> from zope.publisher.browser import TestRequest
>>> class Context(object):
... somedates = set()
>>> context = Context()
>>> request = TestRequest()
>>> field = Set(__name__='somedates')
>>> field.set(context, set([datetime.date(2006, 12, 6),
... datetime.date(2006, 12, 7)]))
>>> field = field.bind(context)
>>> widget = DateSetWidget(field, object(), request)
>>> print widget() # doctest: +REPORT_NDIFF
<BLANKLINE>
<input class="textType" id="field.somedates" name="field.somedates" size="30" type="text" value="" />
<input type="button" value="..." id="field.somedates_trigger">
<script type="text/javascript">
<BLANKLINE>
var multi_field_somedates = [new Date(2006, 11, 6), new Date(2006, 11, 7)];
Calendar.setup({
inputField: 'field.somedates',
button: 'field.somedates_trigger',
ifFormat: '%Y-%m-%d',
onClose: getMultipleDateClosedHandler("field.somedates", multi_field_somedates),
multiple: multi_field_somedates
});
<BLANKLINE>
</script>
<BLANKLINE>
>>> print widget.hidden() # doctest: +REPORT_NDIFF
<input class="hiddenType" id="field.somedates" name="field.somedates" type="hidden" value="" />
<input type="button" value="..." id="field.somedates_trigger">
<script type="text/javascript">
<BLANKLINE>
var multi_field_somedates = [new Date(2006, 11, 6), new Date(2006, 11, 7)];
Calendar.setup({
inputField: 'field.somedates',
button: 'field.somedates_trigger',
ifFormat: '%Y-%m-%d',
onClose: getMultipleDateClosedHandler("field.somedates", multi_field_somedates),
multiple: multi_field_somedates
});
<BLANKLINE>
</script>
====================
Datetime Widget Demo
====================
This demo packe provides a simple content class which uses the
zc.datetimewidget
>>> from zope.testbrowser.testing import Browser
>>> browser = Browser()
>>> browser.handleErrors = False
>>> browser.addHeader('Authorization', 'Basic mgr:mgrpw')
>>> browser.open('http://localhost/@@contents.html')
It can be added by clicking on the "Datetimewidget Demo" link in the
add menu. And giving it a name.
>>> link = browser.getLink('Datetimewidget Demo')
>>> link.click()
>>> nameCtrl = browser.getControl(name='new_value')
>>> nameCtrl.value = 'mydemo'
>>> applyCtrl = browser.getControl('Apply')
>>> applyCtrl.click()
>>> link = browser.getLink('mydemo')
>>> link.click()
>>> browser.url
'http://localhost/mydemo/@@edit.html'
We can fill in the values
>>> browser.getControl('Start Date').value = '2006-11-15'
>>> browser.getControl('End Date').value = '2006-11-16'
>>> browser.getControl('Start Datetime').value = '2006-11-15T07:49:31Z'
>>> browser.getControl('End Datetime').value = '2006-11-16T19:46:00Z'
>>> browser.getControl('Several dates').value = '2006-11-20 2006-11-21 2006-11-22'
>>> browser.getControl('Change').click()
And they will be saved:
>>> 'Required input is missing' in browser.contents
False
>>> '2006-11-15' in browser.contents
True
>>> '2006-11-16' in browser.contents
True
>>> '07:49' in browser.contents
True
>>> '19:46' in browser.contents
True
>>> '2006-11-20 2006-11-21 2006-11-22' in browser.contents
True
If we do not fill some fields, we get missing value errors
>>> browser.getControl('Start Date').value = ''
>>> browser.getControl('Change').click()
>>> 'Required input is missing' in browser.contents
True
Let's step back:
>>> browser.getControl('Start Date').value = '2006-11-15'
>>> browser.getControl('Change').click()
>>> 'Required input is missing' in browser.contents
False
Now let's try not filling a date set field:
>>> browser.getControl('Several dates').value = ''
>>> browser.getControl('Change').click()
>>> 'Required input is missing' in browser.contents
True
=======
CHANGES
=======
0.7.0 (2011-06-07)
------------------
- Fix tests using a newer zope.publisher that requires zope.login.
- Fix tests by not using deprecated ``zope.app.securitypolicy``
- Remove test dependency ``zope.app.server`` and ``zope.app.authentication``.
Use ``zope.password`` instead.
- No longer using deprecated ``zope.testing.doctestunit``. Use python's
build-in ``doctest`` instead.
0.6.4 (2009-10-20)
------------------
- Make Calendar pop-up and drag behavior more consistent across
browser modes in IE.
0.6.3 (2009-08-24)
------------------
- Fixed handling of naive datetime objects, they no longer result in
an exception but are displayed unchanged. When they get saved again
they are saved with UTC timezone like all other ones.
- Added `datetimewidget.txt` doctest to ``long_description`` to show
up on pypi home page.
- Fixed home page name in `setup.py`.
- Added coverage analysis tools to buildout.
- Removed deprecated zpkg and zcml slugs.
0.6.2 (2009-05-20)
------------------
- Using `++resource++` instead of `@@/` to load resources.
- Renaming "lang" directory (``ZPublisher`` gets confused because of a
view with the same name exists in ``zope.traversing.namespace``).
See `gocept.datetimewidget`_ for more details on how to use
zc.datetimewidget with zope2.
.. _`gocept.datetimewidget` : http://pypi.python.org/pypi/gocept.datetimewidget
0.6.1 (2008-05-29)
------------------
- Unchanged from 0.5.2, but released with a new version number thanks to a
package with an 0.6.1dev-rBFN revision found in the wild.
0.5.2 (2007-11-03)
------------------
- Improve package data.
- Developed proper package dependencies.
- Merged functional tests into ``tests.py``.
0.5.1 (2006-06-15)
------------------
- Include license and copyright headers.
0.5.0 (2006-05-24)
------------------
- Initial release.
Keywords: zope3 date datetime widget javascript
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Zope Public License
Classifier: Programming Language :: Python
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Framework :: Zope3
|