[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 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')

Radek


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