Check if betterproto has wrapper support in idiomatic way

This commit is contained in:
boukeversteegh 2020-06-03 23:53:36 +02:00
parent 7ecf3fe0e6
commit 919b0a6a7d

View File

@ -202,7 +202,7 @@ def generate_code(request, response):
) )
if match_wrapper: if match_wrapper:
wrapped_type = "TYPE_" + match_wrapper.group(1).upper() wrapped_type = "TYPE_" + match_wrapper.group(1).upper()
if wrapped_type in dir(betterproto): if hasattr(betterproto, wrapped_type):
field_wraps = f"betterproto.{wrapped_type}" field_wraps = f"betterproto.{wrapped_type}"
map_types = None map_types = None