Skip to content

Commit

Permalink
Merge pull request #2134 from MIT-LCP/bm/zip-name-legacy-flag
Browse files Browse the repository at this point in the history
Add "legacy" parameter to PublishedProject.zip_name
  • Loading branch information
tompollard authored Nov 19, 2023
2 parents bdfa393 + 71e2fca commit 668a5b1
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions physionet-django/project/modelcomponents/publishedproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,11 +123,21 @@ def slugged_label(self):
"""
return '-'.join((slugify(self.title), self.version.replace(' ', '-')))

def zip_name(self, full=False):
def zip_name(self, full=False, legacy=True):
"""
Name of the zip file. Either base name or full path name.
If legacy is true, use the project title to generate the file
name (e.g. "demo-ecg-signal-toolbox-10.5.24.zip").
If false, use the project slug (e.g. "demoecg-10.5.24.zip").
Eventually the old style will be replaced with the new style.
"""
name = '{}.zip'.format(self.slugged_label())
if legacy:
name = '{}.zip'.format(self.slugged_label())
else:
name = '{}-{}.zip'.format(self.slug, self.version)
if full:
name = os.path.join(self.project_file_root(), name)
return name
Expand Down

0 comments on commit 668a5b1

Please sign in to comment.