Skip to content

dictlist is using list instead of dictΒ #192

@janstarke

Description

@janstarke

My Testcode:

import sys
from flow.record import RecordDescriptor, RecordStreamWriter

TestRecord1 = RecordDescriptor(
    "test/csv_test1",
    [
        ("string", "field11"),
        ("string", "field12"),
        ("string", "field13"),
        ("dictlist", "field14")
    ]
)

rec1 = TestRecord1(
    field11 = "AB",
    field12 = "CD",
    field13 = "EF",
    field14 = {
        "Name": "George",
        "Surname": "Washington"
    }
)

record_writer = RecordStreamWriter(sys.stdout.buffer)

record_writer.write(rec1)

How to run the code:

python3 tests/test-records.py | rdump

Expected output:

[reading from stdin]
<test/csv_test1 field11='AB' field12='CD' field13='EF' field14={'Name': 'George', 'Surname': 'Washington'}>

Actual output:

[reading from stdin]
<test/csv_test1 field11='AB' field12='CD' field13='EF' field14=['Name', 'Surname']>

Suggested Fix

Change to code in

class dictlist(list, FieldType):

to

class dictlist(dict, FieldType):

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