Skip to content

FileInfo section in imported EDS is not kept when exporting EDS #302

Closed

Description

@Sudlav

When an EDS file is imported by import_eds() method the FileInfo section is stored in od._edsFileInfo.
However, if the object dictionary is then stored as a new eds file using export_eds() method, then the FileInfo section is lost.

The reason seems to be indentation level of four lines in export_eds():

    try:
        # only if eds was loaded by us
        origFileInfo = od.__edsFileInfo
    except AttributeError:
        origFileInfo = {
            # just set some defaults
            "CreationDate": defmtime.strftime("%m-%d-%Y"),
            "CreationTime": defmtime.strftime("%I:%m%p"),
            "EdsVersion": 4.2,
        }

        file_info.setdefault("ModificationDate", defmtime.strftime("%m-%d-%Y"))  # This line,
        file_info.setdefault("ModificationTime", defmtime.strftime("%I:%m%p"))   # this line,
        for k, v in origFileInfo.items():                                        # this line
            file_info.setdefault(k, v)                                           # and this line
                                                                                 # should decrease indentation level by 1
    eds.add_section("FileInfo")
    for k, v in file_info.items():
        eds.set("FileInfo", k, v)

file_info is an empty dicitionary that is populated ony if __edsFileInfo does not exist as an attribute to od.
If __edsFileInfo exists, then file_info remains empty and no FileInfo section will be exported.

Activity

  1. af-silva commented on Mar 18, 2022

    @af-silva
    Collaborator

    fix by #303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions