From 21f1860d598a2df4a5b97c624a18abc4ed9e1675 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Thu, 6 Jan 2022 18:02:00 +0100 Subject: Update to Python3 --- app/backend.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'app/backend.py') diff --git a/app/backend.py b/app/backend.py index 94e7c67..0f1b359 100644 --- a/app/backend.py +++ b/app/backend.py @@ -10,12 +10,12 @@ class Storage: self.root = path_rel def _join(self, *components): - return os.path.join(self.path, *(ensureutf8(c) for c in components)) + return os.path.join(self.path, *components) def get_courses(self): """ Lists all courses of a study """ - return [o.decode('utf-8') for o in os.listdir(self.path) - if os.path.isdir(self._join(o))] + return [o for o in os.listdir(self.path) + if os.path.isdir(self._join(o))] def exam_exists(self, course, year, name): """ Exists if an exam (file) exists """ @@ -45,12 +45,5 @@ class Storage: if year.isdigit(): # yield entries as tuples (name, path) grouped by years func = partial(os.path.join, self.root, course, year) - # filenames created by this app are always ascii-only, but let's - # decode it nonetheless just to be sure... - entries = [(f.decode('utf-8'), func(f)) for f in files] + entries = [(f, func(f)) for f in files] yield (year, entries) - -def ensureutf8(s): - if isinstance(s, unicode): - return s.encode('utf-8') - return s -- cgit v1.2.3-1-g7c22