Skip to content

Consolidate the file upload widget value metadata and content? #2721

@jasongrout

Description

@jasongrout

We've recently discussed the format for the file upload value attribute. It looks like what was settled on was something like:

[{'metadata': {'name': 'Untitled1.ipynb',
   'type': '',
   'size': 1734,
   'lastModified': 1552316652863},
  'content': <memory at 0x10eeadd00>}]

In playing around with it a bit, it seems much simpler to just combine it into one dictionary, sort of like how the Jupyter contents api does it:

[{'name': 'Untitled1.ipynb',
   'type': '',
   'size': 1734,
   'lastModified': 1552316652863,
   'content': <memory at 0x10eeadd00>}]

I think it's simpler to not have to go through the metadata key, like:

for f in widget.value:
    print(f['name'])
    print(f['size'])
    print(f["content"].tobytes().decode("utf-8"))

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    resolved-lockedClosed issues are locked after 30 days inactivity. Please open a new issue for related discussion.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions