@@ -94,7 +94,7 @@ message Person {
9494
9595 message PhoneNumber {
9696 optional string number = 1;
97- optional PhoneType type = 2 [default = HOME ];
97+ optional PhoneType type = 2 [default = PHONE_TYPE_HOME ];
9898 }
9999
100100 repeated PhoneNumber phones = 4;
@@ -348,11 +348,11 @@ def PromptForAddress(person):
348348
349349 phone_type = input("Is this a mobile, home, or work phone? ")
350350 if phone_type == "mobile":
351- phone_number.type = addressbook_pb2.Person.PhoneType.MOBILE
351+ phone_number.type = addressbook_pb2.Person.PhoneType.PHONE_TYPE_MOBILE
352352 elif phone_type == "home":
353- phone_number.type = addressbook_pb2.Person.PhoneType.HOME
353+ phone_number.type = addressbook_pb2.Person.PhoneType.PHONE_TYPE_HOME
354354 elif phone_type == "work":
355- phone_number.type = addressbook_pb2.Person.PhoneType.WORK
355+ phone_number.type = addressbook_pb2.Person.PhoneType.PHONE_TYPE_WORK
356356 else:
357357 print("Unknown phone type; leaving as default value.")
358358
@@ -401,11 +401,11 @@ def ListPeople(address_book):
401401 print(" E-mail address:", person.email)
402402
403403 for phone_number in person.phones:
404- if phone_number.type == addressbook_pb2.Person.PhoneType.MOBILE :
404+ if phone_number.type == addressbook_pb2.Person.PhoneType.PHONE_TYPE_MOBILE :
405405 print(" Mobile phone #: ", end="")
406- elif phone_number.type == addressbook_pb2.Person.PhoneType.HOME :
406+ elif phone_number.type == addressbook_pb2.Person.PhoneType.PHONE_TYPE_HOME :
407407 print(" Home phone #: ", end="")
408- elif phone_number.type == addressbook_pb2.Person.PhoneType.WORK :
408+ elif phone_number.type == addressbook_pb2.Person.PhoneType.PHONE_TYPE_WORK :
409409 print(" Work phone #: ", end="")
410410 print(phone_number.number)
411411
0 commit comments