pombreda / staticdhcpd

Automatically exported from code.google.com/p/staticdhcpd
GNU General Public License v3.0
0 stars 0 forks source link

NameError: global name 'flag' is not defined in libpydhcpserver/dhcp_types/packet.py #23

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
On the latest source of libpydhcpserver on the 2.0.0 branch (bug introduced in 
r682), the getFlag function has the wrong variable name, resulting in an 
exception.

This is easily fixed:

Index: branches/2.0.0/libpydhcpserver/libpydhcpserver/dhcp_types/packet.py
===================================================================
--- 
branches/2.0.0/libpydhcpserver/libpydhcpserver/dhcp_types/packet.py (revision 
698)
+++ 
branches/2.0.0/libpydhcpserver/libpydhcpserver/dhcp_types/packet.py (working 
copy)
@@ -492,21 +492,21 @@
         self.setOption('flags', [flags >> 8 & 0xFF, flags & 0xFF])

     def getFlag(self, bitflag):
         """
         Retrieves a flag-bit from the header.

         :param int bitflag: One of the flag-constants defined in this module,
                             like ``FLAGBIT_BROADCAST``.
         :return bool: The state of the bit.
         """
-        return bool(self._getFlags() & flag)
+        return bool(self._getFlags() & bitflag)

     def setFlag(self, bitflag, state):
         """
         Modifies the header to set a flag-bit.

         :param int bitflag: One of the flag-constants defined in this module,
                             like ``FLAGBIT_BROADCAST``.
         :param bool state: Whether the bit should be set or not.
         :return tuple(2): Whether the bit was changed and its initial value,
                           expressed in boolean.

Original issue reported on code.google.com by johnmdil...@gmail.com on 23 Jun 2014 at 4:53

GoogleCodeExporter commented 9 years ago
Thanks again, John.

I finally finished all core documentation, so I should finally be able to get a 
test environment back up and running this week, hopefully catching these myself 
instead of forcing you to pick up the slack.

-Neil

Original comment by red.hamsterx on 23 Jun 2014 at 5:47