(
        self,
        number,
        int_length,
        dec_length=0,
        include_sign=False,
        positive_sign=" ",
        negative_sign="N",
    )
return str(ascii_string)
Format the number into a fixed length ASCII (iso-8859-1) record.

        Note:
            'Todos los campos numéricos se presentarán alineados a la derecha
            y rellenos a ceros por la izquierda sin signos y sin empaquetar.'
            (http://www.boe.es/boe/dias/2008/10/23/pdfs/A42154-42190.pdf)
Format the number into a fixed length ASCII (iso-8859-1) record.
Format the number into a fixed length ASCII ( iso - 8859 - 1 ) record .
def _format_number(
        self,
        number,
        int_length,
        dec_length=0,
        include_sign=False,
        positive_sign=" ",
        negative_sign="N",
    ):
        """Format the number into a fixed length ASCII (iso-8859-1) record.

        Note:
            'Todos los campos numéricos se presentarán alineados a la derecha
            y rellenos a ceros por la izquierda sin signos y sin empaquetar.'
            (http://www.boe.es/boe/dias/2008/10/23/pdfs/A42154-42190.pdf)
        """
        #
        # Separate the number parts (-55.23 => int_part=55,
        # dec_part=0.23, sign='N')
        #
        if number == "":
            number = 0.0
        number = float(number)
        sign = number >= 0 and positive_sign or negative_sign
        number = abs(number)
        int_part = int(number)
        # Format the string
        ascii_string = ""
        if include_sign:
            ascii_string += sign
        if dec_length > 0:
            ascii_string += "%0*.*f" % (int_length + dec_length + 1, dec_length, number)
            ascii_string = ascii_string.replace(".", "")
        elif int_length > 0:
            ascii_string += "%.*d" % (int_length, int_part)
        # Sanity-check
        assert (
            len(ascii_string) == (include_sign and 1 or 0) + int_length + dec_length
        ), _("The formated string must match the given length")
        # Return the string assuring that is not unicode
        return str(ascii_string)
def _format_number ( self , number , int_length , dec_length = 0 , include_sign = False , positive_sign = " " , negative_sign = "N" , ) : # # Separate the number parts (-55.23 => int_part=55, # dec_part=0.23, sign='N') # if number == "" : number = 0.0 number = float ( number ) sign = number >= 0 and positive_sign or negative_sign number = abs ( number ) int_part = int ( number ) # Format the string ascii_string = "" if include_sign : ascii_string += sign if dec_length > 0 : ascii_string += "%0*.*f" % ( int_length + dec_length + 1 , dec_length , number ) ascii_string = ascii_string . replace ( "." , "" ) elif int_length > 0 : ascii_string += "%.*d" % ( int_length , int_part ) # Sanity-check assert ( len ( ascii_string ) == ( include_sign and 1 or 0 ) + int_length + dec_length ) , _ ( "The formated string must match the given length" ) # Return the string assuring that is not unicode return str ( ascii_string )