Skip to content

question about dict2pb function #2

@sumtiogo

Description

@sumtiogo
for field in obj.DESCRIPTOR.fields:
    if not field.label == field.LABEL_REQUIRED:
        continue
    if not field.has_default_value:
        continue
    if not field.name in adict:
        raise ConvertException(
            'Field "%s" missing from descriptor dictionary.'
            % field.name)

I have question about the second if statement

if not field.has_default_value:
continue

does this loop meant to check:
if there is a filed which is labeled require but without default value, then the filed.name must be the key in adict.

if so, maybe we should change this if statement to:

if not field.has_default_value:
continue

If I misunderstand anything, please let me know.
Thanks a lot.

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