Commits

Senthil Kumaran committed a0d5093

py3kify web_display

Comments (0)

Files changed (1)

urwid/web_display.py

                 continue
             assert len(item) == 2, "Invalid register_palette usage"
             name, like_name = item
-            if not self.palette.has_key(like_name):
+            if like_name not in self.palette:
                 raise Exception("palette entry '%s' doesn't exist"%like_name)
             self.palette[name] = self.palette[like_name]
 
         urwid_id = "%09d%09d"%(random.randrange(10**9),
             random.randrange(10**9))
         self.pipe_name = os.path.join(_prefs.pipe_dir,"urwid"+urwid_id)
-        os.mkfifo(self.pipe_name+".in",0600)
+        os.mkfifo(self.pipe_name+".in",0o600)
         signal.signal(signal.SIGTERM,self._cleanup_pipe)
 
         self.input_fd = os.open(self.pipe_name+".in",
             rows = MAX_ROWS
         self.screen_size = cols, rows
 
-    def draw_screen(self, (cols, rows), r ):
+    def draw_screen(self, xxx_todo_changeme, r ):
         """Send a screen update to the client."""
-
+        (cols, rows) = xxx_todo_changeme
         if cols != self.last_screen_width:
             self.last_screen = {}
 
         try:
             iready,oready,eready = select.select(
                 [self.input_fd],[],[],0.5)
-        except select.error, e:
+        except select.error as e:
             # return on interruptions
             if e.args[0] == 4:
                 if raw_keys:
     """
     Return True if this is a CGI web request.
     """
-    return os.environ.has_key('REQUEST_METHOD')
+    return 'REQUEST_METHOD' in os.environ
 
 def handle_short_request():
     """
         # Don't know what to do with head requests etc.
         return False
 
-    if not os.environ.has_key('HTTP_X_URWID_ID'):
+    if 'HTTP_X_URWID_ID' not in os.environ:
         # If no urwid id, then the application should be started.
         return False