Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enum in a nested message doesn't appear to get set #16

Open
joeshaw opened this issue Oct 31, 2012 · 1 comment
Open

enum in a nested message doesn't appear to get set #16

joeshaw opened this issue Oct 31, 2012 · 1 comment

Comments

@joeshaw
Copy link
Contributor

joeshaw commented Oct 31, 2012

If I have a definition like so:

enum Status {
    IN_PROGRESS = 1;
    ERROR = 2;
}

message Foo {
    message Bar {
        optional Status status = 1;
    }

    optional Bar bar = 1;
}

And code like so:

foo = Foo()
foo.bar = Foo_Bar()
foo.bar.status = Status.IN_PROGRESS
print foo.bar.status

None is printed instead of 1. Things work ok if I move the status field from the inner Bar message to the outer Foo.

@joeshaw
Copy link
Contributor Author

joeshaw commented Oct 31, 2012

I can work around this by constructing the inner object first and then assigning it to the parent object. For example:

foo = Foo()
bar = Foo_Bar()
bar.status = Status.IN_PROGRESS
foo.bar = bar
print foo.bar.status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant