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