Issue1481
Created on 2009-09-29.16:28:22 by jsamsa, last changed 2013-02-06.20:32:03 by fwierzbicki.
msg5205 (view) |
Author: Jason Samsa (jsamsa) |
Date: 2009-09-29.16:28:21 |
|
C:\>jython
Jython 2.5.1 (Release_2_5_1:6813, Sep 26 2009, 13:47:54)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)] on java1.6.0_15
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strptime('09/01/2009', 'm')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:783)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:576)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:501)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:476)
at org.python.modules.time.Time.strptime(Time.java:705)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException:
Unterminated quote
>>> exit()
C:\>python
Python 2.5.2 (r252:60911, Dec 2 2008, 09:26:14)
[GCC 3.4.4 (cygming special, gdc 0.12, using dmd 0.125)] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> time.strptime('09/01/2009', 'm')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/_strptime.py", line 330, in strptime
(data_string, format))
ValueError: time data did not match format: data=09/01/2009 fmt=m
>>> exit()
the above is causing some issues with date validation in django.forms
(Django version 1.1)
|
msg5206 (view) |
Author: Jason Samsa (jsamsa) |
Date: 2009-09-29.17:13:53 |
|
This isn't causing a problem in Django, I passed a string where a list
is required. The issue of the wrong exception stands.
|
msg6544 (view) |
Author: Andreas Stührk (Trundle) |
Date: 2011-06-09.00:42:27 |
|
An `IllegalArgumentException` is thrown when a single quote is used in the format string because Jython doesn't escape them.
The attached patch fixes that. An `IllegalArgumentException` can still be thrown if you use a single quote as a directive, but that should be fixed in a separate issue as invalid directives should raise a `ValueError`.
|
msg7428 (view) |
Author: Arfrever Frehtes Taifersar Arahesis (Arfrever) |
Date: 2012-08-28.08:16:25 |
|
Has this issue been fixed by fix for issue #1662?
http://hg.python.org/jython/rev/f1fae083ee2d
|
msg7431 (view) |
Author: Jim Baker (zyasoft) |
Date: 2012-08-28.14:20:05 |
|
Dupe of #1662 as Arfrever points out
|
msg7438 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2012-08-28.20:37:26 |
|
I think I still need to review and possibly apply this one. There is a remaining problem that I think is trivially fixed by the patch - it's not the original reported problem - but this one:
>>> time.strptime('09/01/2009', "'")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
at java.text.SimpleDateFormat.compile(SimpleDateFormat.java:782)
at java.text.SimpleDateFormat.initialize(SimpleDateFormat.java:575)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:500)
at java.text.SimpleDateFormat.<init>(SimpleDateFormat.java:475)
at org.python.modules.time.Time.strptime(Time.java:707)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Unterminated quote
>>>
|
msg7631 (view) |
Author: Frank Wierzbicki (fwierzbicki) |
Date: 2013-02-06.20:32:03 |
|
Patch applied in http://hg.python.org/jython/rev/328c4e80117f thanks Andreas Stührk!
|
|
Date |
User |
Action |
Args |
2013-02-06 20:32:03 | fwierzbicki | set | status: open -> closed resolution: fixed messages:
+ msg7631 |
2012-08-28 20:37:26 | fwierzbicki | set | status: closed -> open resolution: duplicate -> (no value) messages:
+ msg7438 |
2012-08-28 14:20:05 | zyasoft | set | status: open -> closed resolution: duplicate messages:
+ msg7431 |
2012-08-28 08:16:26 | Arfrever | set | nosy:
+ zyasoft, Arfrever messages:
+ msg7428 |
2012-08-10 20:41:08 | fwierzbicki | set | priority: normal assignee: fwierzbicki |
2012-03-20 17:35:49 | fwierzbicki | set | nosy:
+ fwierzbicki |
2012-03-19 19:37:21 | amak | set | nosy:
+ amak |
2011-06-09 00:42:28 | Trundle | set | files:
+ escape_single_quote.patch keywords:
+ patch messages:
+ msg6544 nosy:
+ Trundle |
2009-09-29 17:13:53 | jsamsa | set | messages:
+ msg5206 |
2009-09-29 16:28:22 | jsamsa | create | |
|