From a7327e72060fbb4dac783f1af41bcb9b4ea6da76 Mon Sep 17 00:00:00 2001 From: Siddharth Ravikumar Date: Wed, 1 Apr 2015 22:00:18 -0400 Subject: updated combox.file.relative_path. This method now returns relative paths w. r. t all node directories. Before it used to return relative paths only w. r. t the first node directory. Also updated the tests for it :~( modified: combox/file.py modified: tests/file_test.py --- combox/file.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'combox') diff --git a/combox/file.py b/combox/file.py index 2f18823..81d15fe 100644 --- a/combox/file.py +++ b/combox/file.py @@ -41,10 +41,17 @@ def relative_path(p, config, comboxd=True): combox. """ + directory = None if comboxd: directory = '%s/' % config['combox_dir'] else: - directory = '%s/' % get_nodedirs(config)[0] + for node in get_nodedirs(config): + if p.startswith(node): + directory = '%s/' % node + + if directory is None: + err_msg = "invalid path %s" % p + raise ValueError, err_msg return p.partition(directory)[2] -- cgit v1.2.3