Ben Bass avatar Ben Bass committed d6697f0

fix bit_server by using checked status

Comments (0)

Files changed (1)

pylibftdi/examples/bit_server.py

         page += """
 <fieldset style="background-color: %s; display: inline-block; margin:0px; padding: 8px;">
 <form action="" method="post" >
-<input type="checkbox" onchange="document.querySelector('[name=bit%d]').value=this.value; document.forms[%d].submit()" %s />
+<input type="checkbox" onchange="document.querySelector('[name=bit%d]').value=this.checked; document.forms[%d].submit()" %s />
 <input type="hidden" name="bit%d" />
 </form>
 </fieldset>
         query = self.rfile.read(nbytes)
         # this is lazy and fragile - assumes only a single
         # query parameter XXX
+        print query
         if query.startswith('bit'):
             bit = int(query[3])
-            value = 1 if query.rsplit('=', 1)[-1] == 'on' else 0
+            value = 1 if query.rsplit('=', 1)[-1] == 'true' else 0
             if value:
                 switch.port |= (1 << bit)
             else:
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.