[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [PATCH master] Honor selected hostname on Live CD (#638634)



On Fri, Oct 01, 2010 at 06:52:20PM +0200, Radek Vykydal wrote:
> On 10/01/2010 06:35 PM, Brian C. Lane wrote:
> >
> >>+    @property
> >>+    def gateway(self):
> >>+        """GATEWAY - last device in list wins"""
> >>+        gw = ""
> >>+        for dev in self.netdevices.values():
> >>+            gw = dev.get('GATEWAY')
> >>+        return gw
> >Is this a list? why not use self.netdevices.values()[-1]? After checking
> >to make sure len is>  0 of course.
> >
> 
> Aah thanks, stupid me, it should be:
> 
> for dev in self.netdevices.values():
>     if dev.get('GATEWAY'):
>         gw = dev.get('GATEWAY')
> 

Oh, I see, last entry that has a GATEWAY, and not all entries have it.

It could be simplified with:

gw = dev.get('GATEWAY', gw)

;)

-- 
Brian C. Lane / Anaconda Team
Port Orchard, WA (PST8PDT)

Attachment: pgpsfEGrKFx6F.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]