Returned print_indent and print_outdent back to printservicestub and printserviceclass in python generator

pull/128/head
Krishna 10 years ago
parent 060a2096a3
commit 22f96a713c
  1. 13
      src/google/protobuf/compiler/python/python_generator.cc

@ -581,17 +581,14 @@ void Generator::PrintServiceDescriptor(
} }
void Generator::PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descriptor) const { void Generator::PrintDescriptorKeyAndModuleName(const ServiceDescriptor& descriptor) const {
printer_->Indent();
printer_->Print( printer_->Print(
"$descriptor_key$ = $descriptor_name$,\n", "$descriptor_key$ = $descriptor_name$,\n",
"descriptor_key", kDescriptorKey, "descriptor_key", kDescriptorKey,
"descriptor_name", ModuleLevelServiceDescriptorName(descriptor)); "descriptor_name", ModuleLevelServiceDescriptorName(descriptor));
printer_->Print( printer_->Print(
"__module__ = '$module_name$'\n", "__module__ = '$module_name$'\n",
"module_name", ModuleName(file_->name())); "module_name", ModuleName(file_->name()));
printer_->Print("))\n\n");
printer_->Outdent();
} }
void Generator::PrintServiceClass(const ServiceDescriptor& descriptor) const { void Generator::PrintServiceClass(const ServiceDescriptor& descriptor) const {
@ -599,7 +596,10 @@ void Generator::PrintServiceClass(const ServiceDescriptor& descriptor) const {
printer_->Print("$class_name$ = service_reflection.GeneratedServiceType(" printer_->Print("$class_name$ = service_reflection.GeneratedServiceType("
"'$class_name$', (_service.Service,), dict(\n", "'$class_name$', (_service.Service,), dict(\n",
"class_name", descriptor.name()); "class_name", descriptor.name());
printer_->Indent();
Generator::PrintDescriptorKeyAndModuleName(descriptor); Generator::PrintDescriptorKeyAndModuleName(descriptor);
printer_->Print("))\n\n");
printer_->Outdent();
} }
void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const { void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const {
@ -608,7 +608,10 @@ void Generator::PrintServiceStub(const ServiceDescriptor& descriptor) const {
"service_reflection.GeneratedServiceStubType(" "service_reflection.GeneratedServiceStubType("
"'$class_name$_Stub', ($class_name$,), dict(\n", "'$class_name$_Stub', ($class_name$,), dict(\n",
"class_name", descriptor.name()); "class_name", descriptor.name());
printer_->Indent();
Generator::PrintDescriptorKeyAndModuleName(descriptor); Generator::PrintDescriptorKeyAndModuleName(descriptor);
printer_->Print("))\n\n");
printer_->Outdent();
} }
// Prints statement assigning ModuleLevelDescriptorName(message_descriptor) // Prints statement assigning ModuleLevelDescriptorName(message_descriptor)

Loading…
Cancel
Save