forked from enviPath/enviPy
comments
This commit is contained in:
@ -170,10 +170,11 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
# Create users
|
# Create licenses
|
||||||
self.create_licenses()
|
self.create_licenses()
|
||||||
if options.get("only_licenses", False):
|
if options.get("only_licenses", False):
|
||||||
return
|
return
|
||||||
|
# Create users
|
||||||
anon, admin, g, user0 = self.create_users()
|
anon, admin, g, user0 = self.create_users()
|
||||||
|
|
||||||
self.populate_common_external_databases()
|
self.populate_common_external_databases()
|
||||||
|
|||||||
@ -1076,11 +1076,11 @@ def package(request, package_uuid):
|
|||||||
PackageManager.update_permissions(current_user, current_package, grantee, max_perm)
|
PackageManager.update_permissions(current_user, current_package, grantee, max_perm)
|
||||||
return redirect(current_package.url)
|
return redirect(current_package.url)
|
||||||
elif cc_string is not None:
|
elif cc_string is not None:
|
||||||
if cc_string == "no-license":
|
if cc_string == "no-license": # Reset the package's license
|
||||||
current_package.license = None
|
current_package.license = None
|
||||||
current_package.save()
|
current_package.save()
|
||||||
return redirect(current_package.url)
|
return redirect(current_package.url)
|
||||||
else:
|
else: # Get the license and assign it to the package
|
||||||
current_package.license = License.objects.get(cc_string=cc_string)
|
current_package.license = License.objects.get(cc_string=cc_string)
|
||||||
current_package.save()
|
current_package.save()
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class PackageViewTest(TestCase):
|
|||||||
add_to_group=True,
|
add_to_group=True,
|
||||||
is_active=True,
|
is_active=True,
|
||||||
)
|
)
|
||||||
|
# Create the default license set.
|
||||||
cc_strings = ["by", "by-nc", "by-nc-nd", "by-nc-sa", "by-nd", "by-sa"]
|
cc_strings = ["by", "by-nc", "by-nc-nd", "by-nc-sa", "by-nd", "by-sa"]
|
||||||
for cc_string in cc_strings:
|
for cc_string in cc_strings:
|
||||||
new_license = License()
|
new_license = License()
|
||||||
@ -197,6 +197,7 @@ class PackageViewTest(TestCase):
|
|||||||
|
|
||||||
self.assertIsNone(p.license)
|
self.assertIsNone(p.license)
|
||||||
|
|
||||||
|
# Test other possible licenses
|
||||||
cc_strings = ["by", "by-nc", "by-nc-nd", "by-nc-sa", "by-nd", "by-sa"]
|
cc_strings = ["by", "by-nc", "by-nc-nd", "by-nc-sa", "by-nd", "by-sa"]
|
||||||
for cc_string in cc_strings:
|
for cc_string in cc_strings:
|
||||||
self.client.post(package_url, {"license": cc_string})
|
self.client.post(package_url, {"license": cc_string})
|
||||||
|
|||||||
Reference in New Issue
Block a user