/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos-monitor

  • Committer: Teddy Hogeborn
  • Date: 2019-09-01 04:27:59 UTC
  • Revision ID: teddy@recompile.se-20190901042759-dgadz8cg7x9y83ci
Fix minor Python 3 bytes/str mixups

* mandos (PGPEngine.__init__): Use byte string literals, not strings,
                               when working with byte strings.
  (main): When restoring persistent state from a file created by
          Python 2, also convert the "checker_command" setting from a
          byte string to a string, the same as "name" and "host".

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
 
1
#!/usr/bin/python3 -bb
2
2
# -*- mode: python; coding: utf-8 -*-
3
3
#
4
4
# Mandos Monitor - Control and monitor the Mandos server
5
5
#
6
 
# Copyright © 2009-2017 Teddy Hogeborn
7
 
# Copyright © 2009-2017 Björn Påhlsson
8
 
#
9
 
# This program is free software: you can redistribute it and/or modify
10
 
# it under the terms of the GNU General Public License as published by
 
6
# Copyright © 2009-2019 Teddy Hogeborn
 
7
# Copyright © 2009-2019 Björn Påhlsson
 
8
#
 
9
# This file is part of Mandos.
 
10
#
 
11
# Mandos is free software: you can redistribute it and/or modify it
 
12
# under the terms of the GNU General Public License as published by
11
13
# the Free Software Foundation, either version 3 of the License, or
12
14
# (at your option) any later version.
13
15
#
14
 
#     This program is distributed in the hope that it will be useful,
15
 
#     but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
#     Mandos is distributed in the hope that it will be useful, but
 
17
#     WITHOUT ANY WARRANTY; without even the implied warranty of
16
18
#     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
19
#     GNU General Public License for more details.
18
20
#
19
21
# You should have received a copy of the GNU General Public License
20
 
# along with this program.  If not, see
21
 
# <http://www.gnu.org/licenses/>.
 
22
# along with Mandos.  If not, see <http://www.gnu.org/licenses/>.
22
23
#
23
24
# Contact the authors at <mandos@recompile.se>.
24
25
#
58
59
domain = 'se.recompile'
59
60
server_interface = domain + '.Mandos'
60
61
client_interface = domain + '.Mandos.Client'
61
 
version = "1.7.15"
 
62
version = "1.8.8"
62
63
 
63
64
try:
64
65
    dbus.OBJECT_MANAGER_IFACE
443
444
        self.clients_dict = {}
444
445
 
445
446
        # We will add Text widgets to this list
446
 
        self.log = []
 
447
        self.log = urwid.SimpleListWalker([])
447
448
        self.max_log_length = max_log_length
448
449
 
449
450
        self.log_level = log_level
502
503
        if self.max_log_length:
503
504
            if len(self.log) > self.max_log_length:
504
505
                del self.log[0:len(self.log)-self.max_log_length-1]
505
 
        self.logbox.set_focus(len(self.logbox.body.contents),
 
506
        self.logbox.set_focus(len(self.logbox.body.contents)-1,
506
507
                              coming_from="above")
507
508
        self.refresh()
508
509
 
627
628
                            path=path)
628
629
 
629
630
        self.refresh()
630
 
        self._input_callback_tag = (GLib.io_add_watch
631
 
                                    (sys.stdin.fileno(),
632
 
                                     GLib.IO_IN,
633
 
                                     self.process_input))
 
631
        self._input_callback_tag = (
 
632
            GLib.io_add_watch(
 
633
                GLib.IOChannel.unix_new(sys.stdin.fileno()),
 
634
                GLib.PRIORITY_DEFAULT, GLib.IO_IN,
 
635
                self.process_input))
634
636
        self.main_loop.run()
635
637
        # Main loop has finished, we should close everything now
636
638
        GLib.source_remove(self._input_callback_tag)