1 --- a/swarmlib/connect/schemes/local.py Sun Apr 06 14:09:14 2008 -0400
2 +++ b/swarmlib/connect/schemes/local.py Sun Apr 06 22:20:27 2008 -0400
3 @@ -20,7 +20,9 @@
4 Local connections
5 """
6
7 -class Local(object):
8 +from swarmlib.connect.base_schema import BaseScheme
9 +
10 +class Local(BaseScheme):
11 def __init__(self, parsed_url, config, log, force=False):
12 self._parsed_url = parsed_url
13 self._config = config
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/swarmlib/connect/schemes/base_scheme.py Sun Apr 06 22:20:27 2008 -0400
1.3 @@ -0,0 +1,41 @@
1.4 +# Copyright 2007 Sam Hart
1.5 +#
1.6 +# This program is free software; you can redistribute it and/or modify
1.7 +# it under the terms of the GNU General Public License as published by
1.8 +# the Free Software Foundation; either version 2 of the License, or
1.9 +# (at your option) any later version.
1.10 +#
1.11 +# This program is distributed in the hope that it will be useful,
1.12 +# but WITHOUT ANY WARRANTY; without even the implied warranty of
1.13 +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.14 +# GNU General Public License for more details.
1.15 +#
1.16 +# You should have received a copy of the GNU General Public License
1.17 +# along with this program; if not, write to the Free Software
1.18 +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1.19 +#
1.20 +# Author: Sam Hart
1.21 +
1.22 +"""
1.23 +Swarm Connection Schemes: Base Scheme class
1.24 +
1.25 +This contains the base scheme class by which all schemes are derived
1.26 +"""
1.27 +
1.28 +from swarmlib.config import Config
1.29 +
1.30 +class BaseScheme(object):
1.31 + def __init__(self, parsed_url, config, log, force=False):
1.32 + self._parsed_url = parsed_url
1.33 + self._config = config
1.34 + self._force = force
1.35 + self._log = log
1.36 +
1.37 + def get_config(self):
1.38 + """
1.39 + The BaseScheme defaults to local directories. Overwrite if you
1.40 + don't want this
1.41 + """
1.42 + cwd = self._parsed_url.path
1.43 + self._config = Config(cwd, self._log, self._force)
1.44 + return self._config