~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/config.py

Parametrize the generic tests against the concrete stores.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2162
2162
    def save(self):
2163
2163
        raise NotImplementedError(self.save)
2164
2164
 
 
2165
    def external_url(self):
 
2166
        raise NotImplementedError(self.external_url)
 
2167
 
2165
2168
    def get_sections(self):
2166
2169
        """Returns an ordered iterable of existing sections.
2167
2170
 
2219
2222
            self._config_obj = ConfigObj(co_input, encoding='utf-8')
2220
2223
        except configobj.ConfigObjError, e:
2221
2224
            self._config_obj = None
2222
 
            # FIXME: external_url should really accepts an optional relpath
2223
 
            # parameter (bug #750169) :-/ -- vila 2011-04-04
2224
 
            # The following will do in the interim but maybe we don't want to
2225
 
            # expose a path here but rather a config ID and its associated
2226
 
            # object </hand wawe>.
2227
 
            file_path = os.path.join(self.transport.external_url(),
2228
 
                                     self.file_name)
2229
 
            raise errors.ParseConfigError(e.errors, file_path)
 
2225
            raise errors.ParseConfigError(e.errors, self.external_url())
2230
2226
 
2231
2227
    def save(self):
2232
2228
        if not self.loaded:
2236
2232
        self._config_obj.write(out)
2237
2233
        self.transport.put_bytes(self.file_name, out.getvalue())
2238
2234
 
 
2235
    def external_url(self):
 
2236
        # FIXME: external_url should really accepts an optional relpath
 
2237
        # parameter (bug #750169) :-/ -- vila 2011-04-04
 
2238
        # The following will do in the interim but maybe we don't want to
 
2239
        # expose a path here but rather a config ID and its associated
 
2240
        # object </hand wawe>.
 
2241
        return os.path.join(self.transport.external_url(), self.file_name)
 
2242
 
2239
2243
    def get_sections(self):
2240
2244
        """Get the configobj section in the file order.
2241
2245
 
2323
2327
    def __init__(self, possible_transports=None):
2324
2328
        t = transport.get_transport(config_dir(),
2325
2329
                                    possible_transports=possible_transports)
2326
 
        super(LocationStore, self).__init__(transport, 'locations.conf')
 
2330
        super(LocationStore, self).__init__(t, 'locations.conf')
2327
2331
 
2328
2332
 
2329
2333
class BranchStore(ConfigObjStore):