Exemplo n.º 1
0
    def __init__(self):
        self._conf = Config.Config(tgcm.country_support)
        self._bus = dbus.SystemBus()

        # Attempt to connect to a hypothetical existing TGCM
        # logging service. That must fail because that service
        # must be executed by TGCM exclusively
        try:
            self.__attempt_connection_logging_service()

            # There is an existing TGCM logging service in the
            # system, so it must be closed
            tgcm.warning('Existing TGCM Logging Service found!')
            self.__call_exit()
        except dbus.exceptions.DBusException:
            # It's not necessary to do nothing because that is the
            # expected behavior
            pass

        # Start the TGCM logging service and attempt to connect
        # to it
        try:
            self.__start_tgcm_logging_service()
            self.__attempt_connection_logging_service()
            self.__configure_connection_log()
        except OSError, err:
            tgcm.error('Could not execute TGCM Logging Service: %s' % err)
Exemplo n.º 2
0
    def register_new_hotspot_file(self, in_file, out_file=None):
        out_file = self.hotspots_db_file if (out_file is None) else out_file

        try:
            tree = ElementTree()
            tree.parse(in_file)
        except (xml.etree.ElementTree.ParseError, sqlite3.OperationalError), err:
            # -- This failure appears when importing an empty file. In that case ignore the failure
            # -- but don't forget to create the database!
            tgcm.warning("@WARNING: Importing hotspots file '%s', %s" % (in_file, err))
            return False
Exemplo n.º 3
0
    def register_new_hotspot_file(self, in_file, out_file=None):
        out_file = self.hotspots_db_file if (out_file is None) else out_file

        try:
            tree = ElementTree()
            tree.parse(in_file)
        except (xml.etree.ElementTree.ParseError,
                sqlite3.OperationalError), err:
            # -- This failure appears when importing an empty file. In that case ignore the failure
            # -- but don't forget to create the database!
            tgcm.warning("@WARNING: Importing hotspots file '%s', %s" %
                         (in_file, err))
            return False