Skip to content

Commit

Permalink
Test for non-empty path while inserting files
Browse files Browse the repository at this point in the history
  • Loading branch information
emi80 committed Mar 4, 2015
1 parent 8839d16 commit 83c843c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion indexfile/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,8 @@ def insert(self, update=False, addkeys=False, dataset=None, **kwargs):
:keyword update: specifies whether existing values has to be updated
:keyword dataset: the :class:`Dataset` to be inserted into the index
"""
empty_paths = [None, '', '.']

meta = kwargs
if self.format.get('fileinfo'):
log.debug('Use file specific keywords from the format')
Expand Down Expand Up @@ -215,7 +217,8 @@ def insert(self, update=False, addkeys=False, dataset=None, **kwargs):
else:
log.debug('Use existing dataset %s', dataset.id)

if kwargs.get('path'):
if kwargs.get('path') not in empty_paths:
#if os.path.isfile(kwargs.get('path')):
log.debug('Add %s to dataset', kwargs.get('path'))
dataset.add_file(update=update, **kwargs)

Expand Down

0 comments on commit 83c843c

Please sign in to comment.