@@ -161,7 +161,6 @@ def __delattr__(self, *args, **kwargs):
161161 def __setattr__ (self , name , value ):
162162 # Handle dynamic data only if an initialised dynamic document
163163 if self ._dynamic and not self ._dynamic_lock :
164-
165164 if name not in self ._fields_ordered and not name .startswith ("_" ):
166165 DynamicField = _import_class ("DynamicField" )
167166 field = DynamicField (db_field = name , null = True )
@@ -372,7 +371,7 @@ def to_mongo(self, use_db_field=True, fields=None):
372371 value = field .generate ()
373372 self ._data [field_name ] = value
374373
375- if ( value is not None ) or ( field .null ) :
374+ if value is not None or field .null :
376375 if use_db_field :
377376 data [field .db_field ] = value
378377 else :
@@ -451,7 +450,8 @@ def to_json(self, *args, **kwargs):
451450 "No 'json_options' are specified! Falling back to "
452451 "LEGACY_JSON_OPTIONS with uuid_representation=PYTHON_LEGACY. "
453452 "For use with other MongoDB drivers specify the UUID "
454- "representation to use." ,
453+ "representation to use. This will be changed to "
454+ "uuid_representation=UNSPECIFIED in a future release." ,
455455 DeprecationWarning ,
456456 )
457457 kwargs ["json_options" ] = LEGACY_JSON_OPTIONS
@@ -481,7 +481,8 @@ def from_json(cls, json_data, created=False, **kwargs):
481481 "No 'json_options' are specified! Falling back to "
482482 "LEGACY_JSON_OPTIONS with uuid_representation=PYTHON_LEGACY. "
483483 "For use with other MongoDB drivers specify the UUID "
484- "representation to use." ,
484+ "representation to use. This will be changed to "
485+ "uuid_representation=UNSPECIFIED in a future release." ,
485486 DeprecationWarning ,
486487 )
487488 kwargs ["json_options" ] = LEGACY_JSON_OPTIONS
@@ -517,9 +518,6 @@ def __expand_dynamic_values(self, name, value):
517518
518519 def _mark_as_changed (self , key ):
519520 """Mark a key as explicitly changed by the user."""
520- if not key :
521- return
522-
523521 if not hasattr (self , "_changed_fields" ):
524522 return
525523
0 commit comments