swarmlib/connect/schemes/base_scheme.py
changeset 266 c5c785fec243
child 267f6e82d635465
       1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
       2 +++ b/swarmlib/connect/schemes/base_scheme.py	Sun Apr 06 22:20:27 2008 -0400
       3 @@ -0,0 +1,41 @@
       4 +# Copyright 2007 Sam Hart
       5 +#
       6 +# This program is free software; you can redistribute it and/or modify
       7 +# it under the terms of the GNU General Public License as published by
       8 +# the Free Software Foundation; either version 2 of the License, or
       9 +# (at your option) any later version.
      10 +#
      11 +# This program is distributed in the hope that it will be useful,
      12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
      13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14 +# GNU General Public License for more details.
      15 +#
      16 +# You should have received a copy of the GNU General Public License
      17 +# along with this program; if not, write to the Free Software
      18 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      19 +#
      20 +# Author: Sam Hart
      21 +
      22 +"""
      23 +Swarm Connection Schemes: Base Scheme class
      24 +
      25 +This contains the base scheme class by which all schemes are derived
      26 +"""
      27 +
      28 +from swarmlib.config import Config
      29 +
      30 +class BaseScheme(object):
      31 +    def __init__(self, parsed_url, config, log, force=False):
      32 +        self._parsed_url = parsed_url
      33 +        self._config = config
      34 +        self._force = force
      35 +        self._log = log
      36 +
      37 +    def get_config(self):
      38 +        """
      39 +        The BaseScheme defaults to local directories. Overwrite if you
      40 +        don't want this
      41 +        """
      42 +        cwd = self._parsed_url.path
      43 +        self._config = Config(cwd, self._log, self._force)
      44 +        return self._config