aboutsummaryrefslogtreecommitdiffhomepage
path: root/python/google/protobuf/descriptor_database.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/google/protobuf/descriptor_database.py')
-rw-r--r--python/google/protobuf/descriptor_database.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/python/google/protobuf/descriptor_database.py b/python/google/protobuf/descriptor_database.py
index 1333f996..40bcdd72 100644
--- a/python/google/protobuf/descriptor_database.py
+++ b/python/google/protobuf/descriptor_database.py
@@ -54,9 +54,9 @@ class DescriptorDatabase(object):
Args:
file_desc_proto: The FileDescriptorProto to add.
Raises:
- DescriptorDatabaseException: if an attempt is made to add a proto
- with the same name but different definition than an exisiting
- proto in the database.
+ DescriptorDatabaseConflictingDefinitionError: if an attempt is made to
+ add a proto with the same name but different definition than an
+ exisiting proto in the database.
"""
proto_name = file_desc_proto.name
if proto_name not in self._file_desc_protos_by_file:
@@ -65,7 +65,7 @@ class DescriptorDatabase(object):
raise DescriptorDatabaseConflictingDefinitionError(
'%s already added, but with different descriptor.' % proto_name)
- # Add the top-level Message, Enum and Extension descriptors to the index.
+ # Add all the top-level descriptors to the index.
package = file_desc_proto.package
for message in file_desc_proto.message_type:
self._file_desc_protos_by_symbol.update(
@@ -76,6 +76,9 @@ class DescriptorDatabase(object):
for extension in file_desc_proto.extension:
self._file_desc_protos_by_symbol[
'.'.join((package, extension.name))] = file_desc_proto
+ for service in file_desc_proto.service:
+ self._file_desc_protos_by_symbol[
+ '.'.join((package, service.name))] = file_desc_proto
def FindFileByName(self, name):
"""Finds the file descriptor proto by file name.