Skip to content

Conversation

@AdamNiederer
Copy link

This prevents a crash when a UTCDateTimeAttribute is nullable and is explicitly
set to None through Model.update

This prevents a crash when a UTCDateTimeAttribute is nullable and is explicitly set to None through Model.update
@AdamNiederer
Copy link
Author

The CI failures appear to be spurious; please let me know if you have any questions.

@theladyjaye
Copy link

I encountered a similar issue with Nullable JSONAttributes , Thanks for the unit test I had initially forgotten to do that in my Pull Request #581

attr = UTCDateTimeAttribute()
assert attr.deserialize(tstamp.strftime(DATETIME_FORMAT)) == tstamp

def test_utc_date_time_desrialize_none(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def test_utc_date_time_desrialize_none(self):
def test_utc_date_time_deserialize_none(self):
@ikonst
Copy link
Contributor

ikonst commented Jan 15, 2019

This is not specific to UTCDateTimeAttribute, so I don't addressing it for a specific attribute type is correct. Furthermore, this is not a problem when you save() so this pretty strongly indicates that deserialize is not expected to handle Nones.

I guess you're doing something like:

my_model.update({ 'my_nullable_date': {'value': None, 'action': 'PUT'}, })

while the correct way would be:

my_model.update({ 'my_nullable_date': {'action': 'DELETE'}, })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants