Message5228
Roundup tracker doesn't support date input in localized notation.
You can't input date such as DD.MM.YYYY.
Patches do the following:
i18n.py
- Add class I18NStaff.
Introduce I18NStaff.date_input_re variable which hold locale specific
regular expression for date parsing.
Introduce I18NStaff.date_input_desc variable which hold locale specific
desciption of date/time format.
Pattern and description can be localized through language translation
file/
(rebuild roundup's language file: cd locale && gmake template after
patch).
In apropriate language file find:
"'''^
((?P<y>\d\d\d\d)([/-](?P<m>\d\d?)([/-](?P<d>\d\d?))?)? # yyyy[-mm[-dd]]
|(?P<a>\d\d?)[/-](?P<b>\d\d?))? # or mm-dd
(?P<n>\.)? # .
(((?P<H>\d?\d):(?P<M>\d\d))?(:(?P<S>\d\d?(\.\d+)?))?)? # hh:mm:ss
(?P<o>[\d\smywd\-+]+)? # offset
$'''"
and replace it to desired expression which will parse your country
specific date/time format.
Regular expression must contain y,m,d group for full date, a,b - for
m-d variant, H,M,S for time
Also replace 'Proper date/time format is "yyyy-mm-dd",
"yyyy-mm-dd.HH:MM:SS.SSS"' to
something which describe date/time format.
- combine I18NStaff with RoundupTranslation, RoundupNullTranslation;
date.py
- remove date regular expression variable (date_re) (it in i18n.py now)
- set date __init__ default parameter from translator=i18n to
translator=i18n.translation,
which is more accurate.
- remove date_re parameter from Date.set()
- do use localized translator.date_input_re and
translator.date_input_desc in Date.set()
cgi/templating.py
- in DateHtmlProperty when _value is a string not converted to date,
plain() and now() throw
exception because of calling _value.local(). Recently somebody fix it
in plain()
( except AttributeError: ...). Repeat this fix.
cgi/client.py
Somebody already do the same thing as i want:
- hide _error_message.
- define function add_error_message.
So, no need to change.
By the way, there is a some issue. Jinja2 template bundled with
roundup1.5 think that error_msg is a string.
But it is a list. So, _error_msg in page has a bad format. When errors
are localized they become unreadable.
cgi/form_parser.py
This is a transit point on the way to hyperdb. The goal is to pass
translator object to rawToHyperDB method. So
- introduce 'translator' variable, which is initialized from 'client'
object;
- define wrapper function rawToHyperDB which respect translator object;
- replace direct call hyperdb.rawToHyperDB to wrapper.
hyperdb.py
- import translation from i18n for default translator value;
- add parameter 'translator' to rawToHyperdb function and pass it to
from_raw() method;
- pass translator to Date object. |
|
Date |
User |
Action |
Args |
2015-02-26 16:38:18 | antmail | set | recipients:
+ antmail |
2015-02-26 16:38:18 | antmail | set | messageid: <1424968698.15.0.012928066947.issue2550871@psf.upfronthosting.co.za> |
2015-02-26 16:38:18 | antmail | link | issue2550871 messages |
2015-02-26 16:38:17 | antmail | create | |
|