Lars Strojny
A keks * initial commit
Lars Strojny commited 8c4e5b8 at 2006-12-17 11:28:02
duplicity-0.4.2-timeout-fixed-backends.py
# Copyright 2002 Ben Escoto
#
# This file is part of duplicity.
#
# Duplicity is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.
#
# Duplicity is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with duplicity; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
"""Provides functions and classes for getting/sending files to destination"""
import os, types, ftplib, tempfile, time, sys
import log, path, dup_temp, file_naming
import socket
# TODO: move into globals?
socket.setdefaulttimeout(10)
class BackendException(Exception): pass
class ParsingException(Exception): pass
def get_backend(url_string):
"""Return Backend object from url string, or None if not a url string
url strings are like
scp://foobar:password@hostname.net:124/usr/local. If a protocol
is unsupported a fatal error will be raised.
"""
global protocol_class_dict
try: pu = ParsedUrl(url_string)
except ParsingException: return None
try: backend_class = protocol_class_dict[pu.protocol]
except KeyError: log.FatalError("Unknown protocol '%s'" % (pu.protocol,))
return backend_class(pu)
class ParsedUrl:
"""Contains information gleaned from a generic url"""
protocol = None # set to string like "ftp" indicating protocol
suffix = None # Set to everything after protocol://
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX