Skip to content

DataObjFormatter "format" attribute not working correctly #2351

@maxpatiiuk

Description

@maxpatiiuk

See DataObjFormatter definition:

      <format
        name="Locality"
        title="Locality"
        class="edu.ku.brc.specify.datamodel.Locality"
        default="true"
        >
        <switch single="true">
            <fields>
                <field>localityName</field>
                <field sep="; ">geography.fullName</field>
                <field type="bigdecimal" format="%9.2f" sep="; ">latitude1</field>
                <field type="bigdecimal" format="%9.2f" sep=", ">longitude1</field>
            </fields>
        </switch>
    </format>

The format attribute on <field /> is ignored by the front-end, but causes the back-end to get confused and output the raw value of the output rather than a formatted output:

Screen Shot 2022-10-25 at 12 03 58

Seems to happen here -

def pseudo_sprintf(self, format, expr):

Discovered by @grantfitzsimmons

Metadata

Metadata

Assignees

No one assigned

    Labels

    1 - BugIncorrect behavior of the product2 - FormsIssues that are related to the form system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions