[Patchew-devel] [PATCH 1/3] Usage of getters and setters to get mbox field
Shubham Jain
shubhamjain7495 at gmail.com
Tue May 8 15:05:37 UTC 2018
>
>
>
>
> 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.
Applied the first two patches, thanks!
Should I send the third patch separately?
> Paolo
>
> >
> > On Tue, May 8, 2018 at 6:51 PM Paolo Bonzini <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
> > >
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/patchew-devel/attachments/20180508/a8c87ba4/attachment.htm>
More information about the Patchew-devel
mailing list