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

[tor-commits] [nyx/master] Drop is_geoip_unavailable() usage



commit 8d49aa9c29a88e53c5944c683f28137a7d733787
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Fri Oct 16 15:48:10 2020 -0700

    Drop is_geoip_unavailable() usage
    
    Another deprecated method that has been removed from Stem. This fixes...
    
      Traceback (most recent call last):
        File "./run_nyx", line 14, in <module>
          nyx.main()
        File "/home/atagar/Desktop/nyx/nyx/__init__.py", line 199, in main
          nyx.starter.main()
        File "/home/atagar/Desktop/nyx/stem/util/conf.py", line 287, in wrapped
          return func(*args, config = config, **kwargs)
        File "/home/atagar/Desktop/nyx/nyx/starter.py", line 128, in main
          nyx.curses.start(nyx.draw_loop, acs_support = config.get('acs_support', True), transparent_background = True, cursor = False)
        File "/home/atagar/Desktop/nyx/nyx/curses.py", line 219, in start
          curses.wrapper(_wrapper)
        File "/usr/lib/python3.8/curses/__init__.py", line 105, in wrapper
          return func(stdscr, *args, **kwds)
        File "/home/atagar/Desktop/nyx/nyx/curses.py", line 217, in _wrapper
          function()
        File "/home/atagar/Desktop/nyx/nyx/__init__.py", line 257, in draw_loop
          interface.redraw(force = not key.is_null())
        File "/home/atagar/Desktop/nyx/nyx/__init__.py", line 733, in redraw
          panel.redraw(force = force, top = occupied)
        File "/home/atagar/Desktop/nyx/nyx/panel/__init__.py", line 175, in redraw
          self._last_draw_size = nyx.curses.draw(self._draw, top = self._top, height = self.get_height(), draw_if_resized = draw_dimension)
        File "/home/atagar/Desktop/nyx/nyx/curses.py", line 760, in draw
          func(_Subwindow(subwindow_width, subwindow_height, curses_subwindow))
        File "/home/atagar/Desktop/nyx/nyx/panel/connection.py", line 476, in _draw
          _draw_line(subwindow, scroll_offset, y, lines[line_number], lines[line_number] == selected, subwindow.width - scroll_offset, current_time)
        File "/home/atagar/Desktop/nyx/nyx/panel/connection.py", line 608, in _draw_line
          x = _draw_address_column(subwindow, x, y, line, attr)
        File "/home/atagar/Desktop/nyx/nyx/panel/connection.py", line 630, in _draw_address_column
          elif not tor_controller().is_geoip_unavailable() and not line.entry.is_private():
      AttributeError: 'Controller' object has no attribute 'is_geoip_unavailable'
---
 nyx/panel/connection.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/nyx/panel/connection.py b/nyx/panel/connection.py
index a97d28f..ce5d57b 100644
--- a/nyx/panel/connection.py
+++ b/nyx/panel/connection.py
@@ -627,11 +627,11 @@ def _draw_address_column(subwindow, x, y, line, attr):
 
       if purpose:
         dst += ' (%s)' % str_tools.crop(purpose, 26 - len(dst) - 3)
-    elif not tor_controller().is_geoip_unavailable() and not line.entry.is_private():
+    elif tor_controller().get_info('ip-to-country/ipv4-available', '0') == '1' and not line.entry.is_private():
       dst += ' (%s)' % (line.locale if line.locale else '??')
 
   src = '%-21s' % src
-  dst = '%-21s' % dst if tor_controller().is_geoip_unavailable() else '%-26s' % dst
+  dst = '%-21s' % dst if tor_controller().get_info('ip-to-country/ipv4-available', '0') != '1' else '%-26s' % dst
 
   if line.entry.get_type() in (Category.INBOUND, Category.SOCKS, Category.CONTROL):
     dst, src = src, dst

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits