Exemplo n.º 1
0
    def __init__(self, config_folder, echo=None, poolclass=None, timeout=20):
        # Log the installation location for debug
        nxdrive_install_folder = os.path.dirname(nxdrive.__file__)
        nxdrive_install_folder = os.path.realpath(nxdrive_install_folder)
        log.debug("nxdrive installed in '%s'", nxdrive_install_folder)

        # Log the configuration location for debug
        config_folder = os.path.expanduser(config_folder)
        self.config_folder = os.path.realpath(config_folder)
        if not os.path.exists(self.config_folder):
            os.makedirs(self.config_folder)
        log.debug("nxdrive configured in '%s'", self.config_folder)

        if echo is None:
            echo = os.environ.get('NX_DRIVE_LOG_SQL', None) is not None
        self.timeout = timeout

        # Handle connection to the local Nuxeo Drive configuration and
        # metadata sqlite database.
        self._engine, self._session_maker = init_db(
            self.config_folder, echo=echo, poolclass=poolclass)
        self._local = local()
        self._remote_error = None
        self.device_id = self.get_device_config().device_id
        self.synchronizer = Synchronizer(self)

        # Make all the automation client related to this controller
        # share cookies using threadsafe jar
        self.cookie_jar = CookieJar()
Exemplo n.º 2
0
    def __init__(self, config_folder, echo=False, echo_pool=False,
                 poolclass=None, handshake_timeout=60, timeout=20,
                 page_size=None, max_errors=3):
        # Log the installation location for debug
        nxdrive_install_folder = os.path.dirname(nxdrive.__file__)
        nxdrive_install_folder = os.path.realpath(nxdrive_install_folder)
        log.info("nxdrive installed in '%s'", nxdrive_install_folder)

        # Log the configuration location for debug
        config_folder = os.path.expanduser(config_folder)
        self.config_folder = os.path.realpath(config_folder)
        if not os.path.exists(self.config_folder):
            os.makedirs(self.config_folder)
        log.info("nxdrive configured in '%s'", self.config_folder)

        if not echo:
            echo = os.environ.get('NX_DRIVE_LOG_SQL', None) is not None
        self.handshake_timeout = handshake_timeout
        self.timeout = timeout
        self.max_errors = max_errors

        # Handle connection to the local Nuxeo Drive configuration and
        # metadata SQLite database.
        self._engine, self._session_maker = init_db(
            self.config_folder, echo=echo, echo_pool=echo_pool,
            poolclass=poolclass)

        # Migrate SQLite database if needed
        migrate_db(self._engine)

        # Thread-local storage for the remote client cache
        self._local = local()
        self._client_cache_timestamps = dict()

        self._remote_error = None
        self._local_error = None

        device_config = self.get_device_config()
        self.device_id = device_config.device_id
        self.version = nxdrive.__version__
        self.updated = self.update_version(device_config)

        # HTTP proxy settings
        self.proxies = None
        self.proxy_exceptions = None
        self.refresh_proxies(device_config=device_config)

        # Recently modified items for each server binding
        self.recently_modified = {}

        self.synchronizer = Synchronizer(self, page_size=page_size)

        # Make all the automation client related to this controller
        # share cookies using threadsafe jar
        self.cookie_jar = CookieJar()
Exemplo n.º 3
0
    def __init__(self,
                 config_folder,
                 echo=False,
                 echo_pool=False,
                 poolclass=None,
                 handshake_timeout=60,
                 timeout=20,
                 page_size=None,
                 max_errors=3):
        # Log the installation location for debug
        nxdrive_install_folder = os.path.dirname(nxdrive.__file__)
        nxdrive_install_folder = os.path.realpath(nxdrive_install_folder)
        log.info("nxdrive installed in '%s'", nxdrive_install_folder)

        # Log the configuration location for debug
        config_folder = os.path.expanduser(config_folder)
        self.config_folder = os.path.realpath(config_folder)
        if not os.path.exists(self.config_folder):
            os.makedirs(self.config_folder)
        log.info("nxdrive configured in '%s'", self.config_folder)

        if not echo:
            echo = os.environ.get('NX_DRIVE_LOG_SQL', None) is not None
        self.handshake_timeout = handshake_timeout
        self.timeout = timeout
        self.max_errors = max_errors

        # Handle connection to the local Nuxeo Drive configuration and
        # metadata SQLite database.
        self._engine, self._session_maker = init_db(self.config_folder,
                                                    echo=echo,
                                                    echo_pool=echo_pool,
                                                    poolclass=poolclass)

        # Migrate SQLite database if needed
        migrate_db(self._engine)

        # Thread-local storage for the remote client cache
        self._local = local()
        self._client_cache_timestamps = dict()

        self._remote_error = None
        self._local_error = None

        device_config = self.get_device_config()
        self.device_id = device_config.device_id
        self.version = nxdrive.__version__
        self.updated = self.update_version(device_config)

        # HTTP proxy settings
        self.proxies = None
        self.proxy_exceptions = None
        self.refresh_proxies(device_config=device_config)

        # Recently modified items for each server binding
        self.recently_modified = {}

        self.synchronizer = Synchronizer(self, page_size=page_size)

        # Make all the automation client related to this controller
        # share cookies using threadsafe jar
        self.cookie_jar = CookieJar()