summaryrefslogtreecommitdiffstats
path: root/combox
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-04-01 22:00:18 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-04-01 22:00:18 -0400
commita7327e72060fbb4dac783f1af41bcb9b4ea6da76 (patch)
treef6f82fc1ce79972008737f281b16a05dd72ccb01 /combox
parent4095aa4caf8021a6b8f44c2c4ca3b76a9c26a91f (diff)
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
Diffstat (limited to 'combox')
-rw-r--r--combox/file.py9
1 files changed, 8 insertions, 1 deletions
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]