[settings]
.
.
#if True: translation must exist that matches alt value (help prevent
accidental loops) Default: False means blanks also match
alttranslationsmustmatch=True
Kind Regards,
Mike
use cases for alt:
- chained translation (as you describe)
- alt value can be given in eg route;
BikeMike wrote:
> Hi Henk-jan,
> It has happened a few times that bots-engine gets into a loop using
> 95-100% CPU, and I have had to kill the process. It took me a while to
> figure out what was happening, but the cause was returning "alt"
> values from the first mapping, with accidentally missing, incorrect or
> disabled translations.
>
yes, ran into that couple of times. quite annoying.
> 1. first translation with no alt value runs.
> 2. the first translation returns an alt value to do a chained
> translation (eg. a cutomised order response file).
> 3. no matching active translation is found with this alt value
> (configuration error)
> 4. therefore the translation with no alt value is chosen and runs
> again - result is an infinite loop.
>
> The logic in transform.py (line 164) is to consider translations that
> match the alt value, but also match translations with no alt value. I
> understand this logic for the partners, but for alt I think the rule
> should be that it "must match" otherwise raise
> TranslationNotFoundError.
>
I agree.
> For me the easiest fix is change line 164
> AND (alt='' OR alt=%(alt)s)
> to
> AND alt=%(alt)s
>
> I guess there may be situations that would rely on the logic the way
> it is now but I cannot envisage any. Can you see a need for it to
> remain as-is? The other alternative may be to add a setting in
> bots.ini for this. eg. altTranslationsMustMatch=True and default it to
> False so existing behaviour is not affected.
>
I can not think of such situations.
I know that I struggled here with default values during deveopment of
bots 1.*:
what is the default value of alt in the translate table, what is the
value of alt in ta.
probably this was the best solution at that time.
the solution you suggest is better now.
henk-jan
> Kind regards,
> Mike
>
>
>
fixed this in the development version.
henk-jan