[Patchew-devel] [PATCH 1/3] Usage of getters and setters to get mbox field

Paolo Bonzini pbonzini at redhat.com
Tue May 8 15:07:58 UTC 2018


On 08/05/2018 17:05, Shubham Jain wrote:
> 
> 
> 
>     This is missing that we want to avoid the SerializerMethodField.
>     Second, usually the imperative "do X" is preferred to the passive ("X is
>     done"):
> 
> Still need to work on writing the better commit messages. 

No problem!  It takes time. :)

>     Applied the first two patches, thanks! 
> 
> Should I send the third patch separately? 

Yes, and you can wait until you have the text/plain support if you want,
since you've now tried to send multi-patch series.  They are related,
and 1) you are learning the workflow so let's practice it more 2) you
are also learning the code more so you can use a little more autonomy.

Thanks,

Paolo

>     Paolo
> 
>     >
>     > On Tue, May 8, 2018 at 6:51 PM Paolo Bonzini <pbonzini at redhat.com
>     <mailto:pbonzini at redhat.com>
>     > <mailto:pbonzini at redhat.com <mailto:pbonzini at redhat.com>>> wrote:
>     >
>     >     On 08/05/2018 13:50, Shubham Jain wrote:
>     >     > Rename the existing "mbox" field to e.g. "mbox_blob" and add
>     >     getters and setters for "mbox"
>     >
>     >     The same remark about the "why" holds here.  Would you like to try
>     >     (re)writing this commit message yourself?  Just replying to
>     this mail
>     >     will do.
>     >
>     >     Thanks!
>     >
>     >     Paolo
>     >
>     >     > ---
>     >     >  api/models.py | 22 ++++++++++++++--------
>     >     >  1 file changed, 14 insertions(+), 8 deletions(-)
>     >     >
>     >     > diff --git a/api/models.py b/api/models.py
>     >     > index 504f2c7..e161325 100644
>     >     > --- a/api/models.py
>     >     > +++ b/api/models.py
>     >     > @@ -321,20 +321,26 @@ class Message(models.Model):
>     >     > 
>     >     >      objects = MessageManager()
>     >     > 
>     >     > -    def save_mbox(self, mbox):
>     >     > -        save_blob(mbox, self.message_id)
>     >     > +    def save_mbox(self, mbox_blob):
>     >     > +        save_blob(mbox_blob, self.message_id)
>     >     > 
>     >     >      def get_mbox_obj(self):
>     >     >          self.get_mbox()
>     >     >          return self._mbox_obj
>     >     > 
>     >     >      def get_mbox(self):
>     >     > -        if hasattr(self, "mbox"):
>     >     > -            return self.mbox
>     >     > -        self.mbox = load_blob(self.message_id)
>     >     > -        self._mbox_obj = MboxMessage(self.mbox)
>     >     > -        return self.mbox
>     >     > -
>     >     > +        if hasattr(self, "mbox_blob"):
>     >     > +            return self.mbox_blob
>     >     > +        self.mbox_blob = load_blob(self.message_id)
>     >     > +        self._mbox_obj = MboxMessage(self.mbox_blob)
>     >     > +        return self.mbox_blob
>     >     > +   
>     >     > +    mbox = property(get_mbox)
>     >     > +
>     >     > +    @mbox.setter
>     >     > +    def mbox(self, value):
>     >     > +        self.mbox_blob = value
>     >     > +   
>     >     >      def get_num(self):
>     >     >          assert self.is_patch or self.is_series_head
>     >     >          cur, total = 1, 1
>     >     >
>     >
> 




More information about the Patchew-devel mailing list