Skip to content

Commit

Permalink
Adding defaults for project_path & project_name
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Ferraz committed Feb 14, 2016
1 parent 2ceec3f commit 5ad10ba
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
6 changes: 4 additions & 2 deletions iprofile/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@

def get_ipython_name(profile_name, config):
return '{0}_{1}'.format(
slugify(config.get('project_name')) or
os.path.basename(os.getcwd()), profile_name
slugify(
config.get('project_name') or os.path.basename(os.getcwd())
),
profile_name
)


Expand Down
10 changes: 10 additions & 0 deletions iprofile/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ def __init__(self):
'project_name': os.path.basename(os.getcwd())
}
self.save()
else:
if not self._config.get('project_path'):
self._config.update({
'project_path': 'iprofiles',
})

if not self._config.get('project_name'):
self._config.update({
'project_name': os.path.basename(os.getcwd())
})

def read(self):
self._config = yaml.load(open(self.filepath, 'r')) or {}
Expand Down

0 comments on commit 5ad10ba

Please sign in to comment.