[Django] #19417: Django 1.4.2 does not support Jython 2.5.3 (strptime issue)

12 views
Skip to first unread message

Django

unread,
Dec 3, 2012, 11:11:39 AM12/3/12
to django-...@googlegroups.com
#19417: Django 1.4.2 does not support Jython 2.5.3 (strptime issue)
-------------------------+-------------------------------------------------
Reporter: fvox13 | Owner: nobody
Type: | Status: new
Uncategorized | Version: 1.4
Component: Forms | Keywords: strptime jython forms datetimefield
Severity: Normal | Has patch: 0
Triage Stage: | UI/UX: 0
Unreviewed |
Easy pickings: 0 |
-------------------------+-------------------------------------------------
As near as I can tell, this is a problem with Django / Jython
compatibility and not my code... if I'm wrong feel free to slap my
wrist...


A form was created with the following field:
start_date = forms.DateTimeField(required=True,
widget=forms.DateTimeInput({'class': 'datetime'}))

The following POST data was passed:
start_date u'11/03/2012 00:00:00'


The following traceback was received when I check for form.is_valid() in
the view:
---

Environment:

Request Method: POST
Request URL: http://127.0.0.1:6701/reports/ondemand/Top_Incident_Types/

Django Version: 1.4.2
Python Version: 2.5.3
Installed Applications:
('django.contrib.formtools',
'django.contrib.humanize',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'mykui.accounts',
'mykui.console',
'mykui.mykonfig',
'mykui.reports',
'mykui.status',
'mykui.updates',
'mykui.util')
Installed Middleware:
('django.middleware.gzip.GZipMiddleware',
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'mykui.middleware.UserMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'mykui.middleware.UnavailableMiddleware',
'mykui.middleware.SystemMessageMiddleware',
'mykui.middleware.TimezoneMiddleware')


Traceback:
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/core/handlers/base.py" in
get_response
111. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/core/handlers/base.py" in
get_response
111. response = callback(request,
*callback_args, **callback_kwargs)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/views/decorators/http.py" in inner
41. return func(request, *args, **kwargs)
File "/usr/share/msa/ui/mykui/decorators.py" in _inner
49. return view(*args, **kwargs)
File "/usr/share/msa/ui/mykui/decorators.py" in _inner
31. return view(*args, **kwargs)
File "/usr/share/msa/ui/mykui/reports/views.py" in reports_ondemand
38. if form.is_valid():
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/forms.py" in is_valid
124. return self.is_bound and not bool(self.errors)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/forms.py" in _get_errors
115. self.full_clean()
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/forms.py" in full_clean
270. self._clean_fields()
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/forms.py" in _clean_fields
287. value = field.clean(value)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/forms.py" in _clean_fields
287. value = field.clean(value)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/fields.py" in clean
153. value = self.to_python(value)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/fields.py" in to_python
437. result = super(DateTimeField, self).to_python(value)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/fields.py" in to_python
342. return self.strptime(value, format)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/fields.py" in to_python
342. return self.strptime(value, format)
File "/usr/share/msa/jython/Lib/site-
packages/Django-1.4.2-py2.5.egg/django/forms/fields.py" in strptime
441. return datetime.datetime.strptime(value, format)
File "/usr/share/msa/jython/Lib/datetime.py" in strptime
1499. return cls(*(_time.strptime(date_string, format))[0:6])

Exception Type: IllegalArgumentException at
/reports/ondemand/Top_Incident_Types/
Exception Value: java.lang.IllegalArgumentException: Illegal pattern
character 'f'

---

At 441, format = '%Y-%m-%d %H:%M:%S.%f'


The %f formatting character was introduced in Python 2.6, but it is not
supported in Jython, even in the 2.7 alphas.
http://bugs.jython.org/issue1964


I remember this code working fine in Django 1.4.1, but I cannot seem to
find a commit that would have broken it during the timeframe between the
1.4.1 and 1.4.2 releases.

--
Ticket URL: <https://code.djangoproject.com/ticket/19417>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Dec 8, 2012, 9:02:06 AM12/8/12
to django-...@googlegroups.com
#19417: Django 1.4.2 does not support Jython 2.5.3 (strptime issue)
-------------------------------------+-------------------------------------
Reporter: fvox13 | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: 1.4
Severity: Normal | Resolution:
Keywords: strptime jython | Triage Stage:
forms datetimefield | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0


Old description:

New description:

As near as I can tell, this is a problem with Django / Jython
compatibility and not my code... if I'm wrong feel free to slap my
wrist...


A form was created with the following field:
start_date = forms.DateTimeField(required=True,
widget=forms.DateTimeInput({'class': 'datetime'}))

The following POST data was passed:
start_date u'11/03/2012 00:00:00'


The following traceback was received when I check for form.is_valid() in
the view:

{{{
Environment:

At 441, format = '%Y-%m-%d %H:%M:%S.%f'


The %f formatting character was introduced in Python 2.6, but it is not
supported in Jython, even in the 2.7 alphas.
http://bugs.jython.org/issue1964


I remember this code working fine in Django 1.4.1, but I cannot seem to
find a commit that would have broken it during the timeframe between the
1.4.1 and 1.4.2 releases.

--

Comment:

This behavior was introduced by the fix for #9459.

--
Ticket URL: <https://code.djangoproject.com/ticket/19417#comment:1>

Django

unread,
Dec 20, 2012, 1:05:24 AM12/20/12
to django-...@googlegroups.com
#19417: Django 1.4.2 does not support Jython 2.5.3 (strptime issue)
-------------------------------------+-------------------------------------
Reporter: fvox13 | Owner: nobody
Type: Bug | Status: new

Component: Forms | Version: 1.4
Severity: Normal | Resolution:
Keywords: strptime jython | Triage Stage: Design
forms datetimefield | decision needed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by russellm):

* type: Uncategorized => Bug
* stage: Unreviewed => Design decision needed


Comment:

Given that this is a known bug in Jython, I'm not sure what the right
response is here. The %f is needed to fix the problem from #9459; the
right solution would seem to be "Fix Jython", not "put in a workaround in
Django".

--
Ticket URL: <https://code.djangoproject.com/ticket/19417#comment:2>

Django

unread,
Dec 20, 2012, 2:06:55 PM12/20/12
to django-...@googlegroups.com
#19417: Django 1.4.2 does not support Jython 2.5.3 (strptime issue)
-------------------------------------+-------------------------------------
Reporter: fvox13 | Owner: nobody

Type: Bug | Status: new
Component: Forms | Version: 1.4
Severity: Normal | Resolution:
Keywords: strptime jython | Triage Stage: Design
forms datetimefield | decision needed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by fvox13):

I agree that Jython is the right place to put the fix. However, as it
stands right now, our documentation is wrong, because it states that we
are compatible with Jython 2.5, when we're not. Some mention of this bug
should appear here: https://docs.djangoproject.com/en/1.4/howto/jython/
especially given how common DateTimeField usage is.

--
Ticket URL: <https://code.djangoproject.com/ticket/19417#comment:3>

Django

unread,
Mar 23, 2013, 3:29:56 AM3/23/13
to django-...@googlegroups.com
#19417: Django 1.4.2 does not support Jython 2.5.3 (strptime issue)
-------------------------------------+-------------------------------------
Reporter: fvox13 | Owner: nobody

Type: Bug | Status: new
Component: Forms | Version: 1.4
Severity: Normal | Resolution:
Keywords: strptime jython | Triage Stage: Accepted
forms datetimefield | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* stage: Design decision needed => Accepted


Comment:

Accepting as a doc fix.

--
Ticket URL: <https://code.djangoproject.com/ticket/19417#comment:4>

Django

unread,
Jun 4, 2013, 1:13:44 PM6/4/13
to django-...@googlegroups.com
#19417: Django 1.4.2 does not support Jython 2.5.3 (strptime issue)
-------------------------------------+-------------------------------------
Reporter: fvox13 | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 1.4

Severity: Normal | Resolution:
Keywords: strptime jython | Triage Stage: Accepted
forms datetimefield | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timo):

* component: Forms => Documentation


--
Ticket URL: <https://code.djangoproject.com/ticket/19417#comment:5>

Django

unread,
Jul 3, 2013, 7:32:16 AM7/3/13
to django-...@googlegroups.com
#19417: Django 1.4.2 does not support Jython 2.5.3 (strptime issue)
-------------------------------------+-------------------------------------
Reporter: fvox13 | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 1.4
Severity: Normal | Resolution: duplicate

Keywords: strptime jython | Triage Stage: Accepted
forms datetimefield | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by timo):

* status: new => closed
* resolution: => duplicate


Comment:

Marking as a duplicate of #20517 which suggests documenting Jython issues
on a wiki page. I've made a note of this issue on that ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/19417#comment:6>

Reply all
Reply to author
Forward
0 new messages