Changes between Version 3 and Version 4 of Ticket #20601, comment 6


Ignore:
Timestamp:
06/15/2013 03:11:54 AM (23 months ago)
Author:
merb
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #20601, comment 6

    v3 v4  
    3333This line will add an , to every 3rd place on the SafeText type so a string of:
    34341000,11 or 1000000,11 will be
    35 1,000,11 or 1,000,000,11 which could get converted to an integer, so the next time intcomma gets called, it thinks that the SafeText type could now get converted to an integer and will then return himself.
    36 So this will be an uncorrect return value it should return either the correct output of 1.000.000,11 or nothing since it isn't a valid number. But i think its better to check if isinstance(value, int) and if not it should check if isinstance(value, float) and when nothing is correct it should try to convert to float
     351,000,11 or 1,000,000,11 which could get converted to an integer, so the next time intcomma gets called,
     36it will just say that it won't get changed so it returns the SafeText String that is incorrect and won't make any sense.
     37So this will be an uncorrect return value it should return either the correct output of 1.000.000,11 or nothing since it isn't a valid number.
     38So I think it would be better to better check the value for localized format numbers or maybe better make a SafeDecimal or SafeFloat variable as a output of floatformat.
    3739
    3840Even this won't fix it: https://github.com/django/django/pull/785/files
    39 Maybe its better to change floatformat to output Decimal or introduce a new Variable called SafeDecimal, that gets converted to float or Decimal when intcomma gets called.
     41since floatformat will return SafeText a localized version of a Decimal value.
Back to Top