Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove regex, add split

James Simasdb6c82852514
diff --git a/wger/exercises/models.py b/wger/exercises/models.py
index a5dd3c329..ff82552b2 100644
--- a/wger/exercises/models.py
+++ b/wger/exercises/models.py
@@ -19,7 +19,6 @@ import six
import uuid
import logging
import bleach
-import re
from django.db import models
from django.template.loader import render_to_string
@@ -331,16 +330,7 @@ class Exercise(AbstractSubmissionModel, AbstractLicenseModel, models.Model):
if request.user.has_perm('exercises.add_exercise'):
self.status = self.STATUS_ACCEPTED
if not self.license_author:
- # Get everything up to semicolon, exclusive.
- # Example: my-gym.com:9090 returns my-gym.com
- results = re.search('^([^:]+).*', request.get_host())
-
- if results:
- name = results.group(1)
- else:
- name = request.get_host()
-
- self.license_author = name
+ self.license_author = request.get_host().split(':')[0]
else:
if not self.license_author:
self.license_author = request.user.username