Skip to content

Commit ad66532

Browse files
committed
fix the abspath(None) is getcwd() bug for when modelfile is None
* I had already fixed it, but then I reintroduced it without thinking. * add another reminder about moving import layer mod into loop and combining with other attributes for custom layers not in carousel
1 parent 1de735f commit ad66532

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

carousel/core/models.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,13 @@ def __init__(self, modelfile=None):
9696
modelpath = self.modelpath
9797
LOGGER.debug('modelfile: %s', modelfile)
9898
else:
99+
# modelfile was either given as arg or wasn't in metaclass
100+
modelpath = None # modelpath will be derived from modelfile
99101
#: model file
100-
self.modelfile = os.path.abspath(modelfile)
101-
modelpath = None # modelfile not in metaclass or given as arg
102+
self.modelfile = modelfile
102103
# get modelpath from modelfile if not in meta class
103104
if modelfile is not None and modelpath is None:
105+
self.modelfile = os.path.abspath(modelfile)
104106
#: model path, used to find layer files relative to model
105107
self.modelpath = os.path.dirname(os.path.dirname(self.modelfile))
106108
# check meta class for model if declared inline
@@ -174,6 +176,7 @@ def _initialize(self):
174176
self._load()
175177
LOGGER.debug('model:\n%r', self.model)
176178
# initialize layers
179+
# FIXME: move import inside loop for custom layers in different modules
177180
mod = importlib.import_module(self.layers_mod, self.layers_pkg)
178181
for layer, value in self.model.iteritems():
179182
# from layers module get the layer's class definition

0 commit comments

Comments
 (0)