Roundup Tracker - Issues

Message5580

Author antmail
Recipients antmail, jerrykan, rouilj
Date 2016-06-05.10:46:05
Message-id <709740875.20160605134601@inbox.ru>
In-reply-to <1465104483.54.0.199798049152.issue2550871@psf.upfronthosting.co.za>
> Hi Anthony:

> Anthony said:
>> The patch with no whitespace problems (i hope) attached here.

> It looks cleaner than the original. Did you merge the patch from
> issue2550887 into it? If so I will close issue2550887.

Unfortunately, i don't know how to combine patch.  May be the best way
is  to  attach patch from issue2550887 to  issue2550871 and then close
issue2550887?

>> Also, the code base of date.py has changed after this patch
>> was written so i did  some  merging.  Unfortunately  I don't
>> know what to get from Mercurial VCS to help other people to
>> apply this patch.

> I don't understand what you mean here. Are you saying this patch
> will not apply to the current head of the default branch?
Yes,  when  I  pulled  changes  there  is  a need of manual merging in
date.py.

> I do have a couple of questions about the patch itself that I don't
> understand.

> On part of the patch has this:

>          if allowdate and info['D'] is not None:
> -            now = Date('.')
> +            now = Date()

> why was this change needed?

Sorry,  I don't remember.  I can only say that this is not crucial
for   patch  functionality.   Probably, i was touching something there
but  then  not reverted it back fully.  The choice of Date with period
argument  and  Date  alone  depends  of   what  seems more cleanly, of
course.

> Also I see:

> -            raise HyperdbValueError, _('property %s: %r is not a number')%(
> +            raise HyperdbValueError, translator.gettext('property %s:
> %r is not a number')%(
>                  kw['propname'], value)

> in a number of places. What does it do? I thought _('....') is
> replaced by the localized version of .... and the items in the tuple
> are just substituted into the localized string. IIUC that is exactly
> the same thing that

>    translator.gettext('...')%(tuple)

> will do. Translator.gettext won't translate any values in the tuple.
> So what does this change accomplish?

A  I  remember this is the main part of the patch. The main problem is
that  localized  translator  object from context of request is lost as
they   move   in   depth   of  roundup  code.  All translation in base
models  (like date.py) are tied to _ variable which is defaulted to no
translation.
So the main difference of
 -            raise HyperdbValueError, _('property %s: %r is not a number')%(
 +            raise HyperdbValueError, translator.gettext('property %s:
is to use translator.gettext() istead of _().

The  patch  is to carefully lower the translator object to  the
depth of code and then use it.

> Also will I need another patch for the Integer patch I just
> committed (reversing what I took out in issue2550886).
> The patch will add the translator:

> -    def from_raw(self, value, **kw):
> +    def from_raw(self, value, translator=translation, **kw):

> to the Integer::from_raw function and insert translator.gettext to
> replace _ .

There  is  no problem. Just the  running tests will not output translated
errors.

> ________________________________________________
> Roundup tracker <issues@roundup-tracker.org>
> <http://issues.roundup-tracker.org/issue2550871>
> ________________________________________________
History
Date User Action Args
2016-06-05 10:46:06antmailsetrecipients: + antmail, rouilj, jerrykan
2016-06-05 10:46:06antmaillinkissue2550871 messages
2016-06-05 10:46:05antmailcreate