예제 #1
0
def remote_storage_factory():
    """A filetracker factory which creates a client that uses the
       remote server at ``settings.FILETRACKER_URL`` and a folder
       ``settings.FILETRACKER_CACHE_ROOT`` as a cache directory.
    """
    return filetracker.Client(remote_url=settings.FILETRACKER_URL,
                              cache_dir=settings.FILETRACKER_CACHE_ROOT)
예제 #2
0
파일: tests.py 프로젝트: marmistrz/oioioi
 def test_real_file_storage(self):
     dir = tempfile.mkdtemp()
     try:
         client = filetracker.Client(cache_dir=dir, remote_store=None)
         storage = FiletrackerStorage(client=client)
         self._test_file_storage(storage)
     finally:
         shutil.rmtree(dir)
예제 #3
0
파일: ft.py 프로젝트: Norbi-S/sioworkers
def init_instance(filetracker_url):
    url_hash = get_url_hash(filetracker_url)
    lock.acquire()
    if not url_hash in ft_clients:
        ft_clients[url_hash] = \
            filetracker.Client(remote_url=filetracker_url,
                               cache_dir=get_cache_dir(filetracker_url))

    util.threadlocal_dir.ft_client_instance = ft_clients[url_hash]
    lock.release()
예제 #4
0
def media_root_factory():
    """A filetracker factory which sets up local client in
       ``settings.MEDIA_ROOT`` folder."""
    return filetracker.Client(cache_dir=settings.MEDIA_ROOT, remote_store=None)
예제 #5
0
파일: client.py 프로젝트: AdiNar/oioioi
def remote_storage_factory():
    """A filetracker factory which creates a client that uses only
       the remote server at ``settings.FILETRACKER_URL``.
    """
    return filetracker.Client(
            remote_url=settings.FILETRACKER_URL, local_store=None)
예제 #6
0
파일: ft.py 프로젝트: Norbi-S/sioworkers
def instance():
    """Returns a singleton instance of :class:`filetracker.Client`."""
    if getattr(util.threadlocal_dir, 'ft_client_instance', None) is None:
        launch_filetracker_server()
        util.threadlocal_dir.ft_client_instance = filetracker.Client()
    return util.threadlocal_dir.ft_client_instance