[Patchew-devel] [PATCH 2/3] rest: POST for message endpoint

Paolo Bonzini pbonzini at redhat.com
Tue May 8 13:20:41 UTC 2018


On 08/05/2018 13:50, Shubham Jain wrote:
> - Add "create" method to MessageManager so that it calls save_mbox()
> - Fix nested writable serializer issue
> - Add test for the create

A better commit message could be

"Creation of a message is handled by the new "create" method in
MessageManager, which also takes care of calling save_mbox().  The code
currently has some code duplication with add_message_from_mbox(), which
will be fixed soon.  The "create" name follows Django idioms more
closely and is what DRF expects.

However, due to the nested AddressSerializer, the CreateModelMixin is
not enough, we have to define a "create" method in BaseMessageSerializer
too."

The idea is to describe what you are actually doing and also say why
you're doing.

Paolo

> ---
>  api/models.py      |  19 +++++++
>  api/rest.py        |  20 ++++---
>  tests/test_rest.py | 153 +++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 185 insertions(+), 7 deletions(-)




More information about the Patchew-devel mailing list