Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Remove encode() usage required by python2

Scott Peshakc26cf356bc18
diff --git a/wger/exercises/management/commands/download-exercise-images.py b/wger/exercises/management/commands/download-exercise-images.py
index 06aaaae40..5488fbfa9 100644
--- a/wger/exercises/management/commands/download-exercise-images.py
+++ b/wger/exercises/management/commands/download-exercise-images.py
@@ -86,7 +86,7 @@ class Command(BaseCommand):
# Get all exercises
result = requests.get(exercise_api.format(remote_url), headers=headers).json()
for exercise_json in result['results']:
- exercise_name = exercise_json['name'].encode('utf-8')
+ exercise_name = exercise_json['name']
exercise_uuid = exercise_json['uuid']
exercise_id = exercise_json['id']
diff --git a/wger/gym/views/export.py b/wger/gym/views/export.py
index cbe1c7a76..404269bbd 100644
--- a/wger/gym/views/export.py
+++ b/wger/gym/views/export.py
@@ -54,34 +54,32 @@ def users(request, gym_pk):
response = HttpResponse(content_type='text/csv')
writer = csv.writer(response, delimiter='\t', quoting=csv.QUOTE_ALL)
- # Python3: the .encode() is only needed for python 2.7. Should this requirement
- # be dropped once, they can be removed.
writer.writerow([_('Nr.'),
- _('Gym').encode('utf8'),
- _('Username').encode('utf8'),
- _('Email').encode('utf8'),
- _('First name').encode('utf8'),
- _('Last name').encode('utf8'),
- _('Gender').encode('utf8'),
- _('Age').encode('utf8'),
- _('ZIP code').encode('utf8'),
- _('City').encode('utf8'),
- _('Street').encode('utf8'),
- _('Phone').encode('utf8')])
+ _('Gym'),
+ _('Username'),
+ _('Email'),
+ _('First name'),
+ _('Last name'),
+ _('Gender'),
+ _('Age'),
+ _('ZIP code'),
+ _('City'),
+ _('Street'),
+ _('Phone')])
for user in Gym.objects.get_members(gym_pk):
address = user.userprofile.address
writer.writerow([user.id,
- gym.name.encode('utf8'),
+ gym.name,
user.username,
user.email,
- user.first_name.encode('utf8'),
- user.last_name.encode('utf8'),
- user.userprofile.get_gender_display().encode('utf8'),
+ user.first_name,
+ user.last_name,
+ user.userprofile.get_gender_display(),
user.userprofile.age,
address['zip_code'],
- address['city'].encode('utf8'),
- address['street'].encode('utf8'),
- address['phone'].encode('utf8')
+ address['city'],
+ address['street'],
+ address['phone']
])
# Send the data to the browser
diff --git a/wger/weight/views.py b/wger/weight/views.py
index 18a438c13..4f6e87e63 100644
--- a/wger/weight/views.py
+++ b/wger/weight/views.py
@@ -124,7 +124,7 @@ def export_csv(request):
writer = csv.writer(response)
weights = WeightEntry.objects.filter(user=request.user)
- writer.writerow([_('Weight').encode('utf8'), _('Date').encode('utf8')])
+ writer.writerow([_('Weight'), _('Date')])
for entry in weights:
writer.writerow([entry.weight, entry.date])