#25060: Add support for str(timedelta) representation in parse_duration
-----------------------------+--------------------------------------
Reporter: vmspike | Owner: nobody
Type: New feature | Status: new
Component: Utilities | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-----------------------------+--------------------------------------
Comment (by vmspike):
Seems str(timedelta) output is locale independent. I've checked on several
locales and all the time output is the same.
{{{
>>> for loc in ('ar_AE', 'ar_BH', 'ar_DZ', 'ar_EG', 'ar_IN', 'ar_IQ',
'ar_JO', 'ar_KW', 'ar_LB', 'ar_LY', 'ar_MA', 'ar_OM', 'ar_QA', 'ar_SA',
'ar_SD', 'ar_SY', 'ar_TN', 'ar_YE', 'C', 'de_AT', 'de_BE', 'de_CH',
'de_DE', 'de_LI', 'de_LU', 'en_AG', 'en_AU', 'en_BW', 'en_CA', 'en_DK',
'en_GB', 'en_HK', 'en_IE', 'en_IN', 'en_NG', 'en_NZ', 'en_PH', 'en_SG',
'en_US', 'en_ZA', 'en_ZM', 'en_ZW', 'it_CH', 'it_IT', 'ja_JP', 'ko_KR',
'mr_IN', 'POSIX', 'ru_RU', 'ru_UA', 'sa_IN', 'tr_CY', 'tr_TR', 'zh_HK',
'zh_TW', 'zu_ZA', ):
... locale.setlocale(locale.LC_ALL, (loc, 'utf-8'))
... str(timedelta(777, 0, 1))
...
'ar_AE.UTF-8'
'777 days, 0:00:00.000001'
'ar_BH.UTF-8'
'777 days, 0:00:00.000001'
etc....
}}}
Also there are some topics in web about formating str(timedelta) according
to locale, it shows str(timedelta) is locale independent. So, I suppose,
we can use English regex.
--
Ticket URL: <https://code.djangoproject.com/ticket/25060#comment:8>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.4062d3117d20abfd611273837462bfd8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.