Skip to content

Commit

Permalink
Correct warning logic (and text) for use.deprecated.format (#1265)
Browse files Browse the repository at this point in the history
  • Loading branch information
edenhill committed Jan 17, 2022
1 parent d2667e9 commit 887ea56
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Confluent's Python client for Apache Kafka

## v1.8.3

v1.8.3 is a maintenance release with the following fixes:

- The warnings for `use.deprecated.format` (introduced in v1.8.2)
had its logic reversed, which result in warning logs to be emitted when
the property was correctly configured, and the log message itself also
contained text that had it backwards.
The warning is now only emitted when `use.deprecated.format` is set
to the old legacy encoding (`True`). #1265



## v1.8.2

v1.8.2 is a maintenance release with the following fixes and enhancements:
Expand Down
8 changes: 4 additions & 4 deletions src/confluent_kafka/schema_registry/protobuf.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,14 +258,14 @@ def __init__(self, msg_type, schema_registry_client, conf=None):
self._use_deprecated_format = conf_copy.pop('use.deprecated.format')
if not isinstance(self._use_deprecated_format, bool):
raise ValueError("use.deprecated.format must be a boolean value")
if not self._use_deprecated_format:
if self._use_deprecated_format:
warnings.warn("ProtobufSerializer: the 'use.deprecated.format' "
"configuration property, and the ability to use the "
"old incorrect Protobuf serializer heading format "
"introduced in confluent-kafka-python v1.4.0, "
"will be removed in an upcoming release in 2021 Q2. "
"Please migrate your Python Protobuf producers and "
"consumers to 'use.deprecated.format':True as "
"consumers to 'use.deprecated.format':False as "
"soon as possible")

self._subject_name_func = conf_copy.pop('subject.name.strategy')
Expand Down Expand Up @@ -482,14 +482,14 @@ def __init__(self, message_type, conf=None):
self._use_deprecated_format = conf_copy.pop('use.deprecated.format')
if not isinstance(self._use_deprecated_format, bool):
raise ValueError("use.deprecated.format must be a boolean value")
if not self._use_deprecated_format:
if self._use_deprecated_format:
warnings.warn("ProtobufDeserializer: the 'use.deprecated.format' "
"configuration property, and the ability to use the "
"old incorrect Protobuf serializer heading format "
"introduced in confluent-kafka-python v1.4.0, "
"will be removed in an upcoming release in 2022 Q2. "
"Please migrate your Python Protobuf producers and "
"consumers to 'use.deprecated.format':True as "
"consumers to 'use.deprecated.format':False as "
"soon as possible")

descriptor = message_type.DESCRIPTOR
Expand Down

0 comments on commit 887ea56

Please sign in to comment.