[PATCH 09/13] Add and use MountpointSelector's attributes and properties

Vratislav Podzimek vpodzime at redhat.com
Fri Mar 14 08:47:39 UTC 2014


On Thu, 2014-03-13 at 20:54 +0100, Vratislav Podzimek wrote:
> On Thu, 2014-03-13 at 11:23 -0700, Brian C. Lane wrote:
> > On Mon, Mar 10, 2014 at 02:22:15PM +0100, Vratislav Podzimek wrote:
> > > This is the proper way how to do it.
> > > 
> > > Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> > > ---
> > >  pyanaconda/ui/gui/spokes/custom.py | 70 +++++++++++++++++++-------------------
> > >  widgets/python/AnacondaWidgets.py  | 20 +++++++++++
> > >  2 files changed, 55 insertions(+), 35 deletions(-)
> > 
> > > +        # our extension not related to the look of the widget
> > > +        self._device = None
> > > +        self._root = None
> > > +
> > > +    @property
> > > +    def device(self):
> > > +        return self._device
> > > +
> > > +    @device.setter
> > > +    def device(self, new_device):
> > > +        self._device = new_device
> > > +
> > > +    @property
> > > +    def root(self):
> > > +        return self._root
> > > +
> > > +    @root.setter
> > > +    def root(self, new_root):
> > > +        self._root = new_root
> > > +
> > 
> > I don't see the point in going to this trouble. If the properties aren't
> > adding any checking/caching/etc. just use them directly.
> I have no problem with using them directly if their names don't start
> with the underscore. Fixing locally by renaming to self.root and
> self.device and removing the extra code.
Unfortunately that doesn't work, probably due to the class not being
inherited from Python's object class (inheriting from doesn't work at
all), so I'm keeping the code as it is in this patch.

-- 
Vratislav Podzimek

Anaconda Rider | Red Hat, Inc. | Brno - Czech Republic



More information about the anaconda-patches mailing list