diff options
author | Alexander Sulfrian <asulfrian@zedat.fu-berlin.de> | 2022-01-06 18:02:00 +0100 |
---|---|---|
committer | Alexander Sulfrian <asulfrian@zedat.fu-berlin.de> | 2022-01-06 18:10:31 +0100 |
commit | 21f1860d598a2df4a5b97c624a18abc4ed9e1675 (patch) | |
tree | 52c6604ec41167f10f368abafe8f8c3d32b00b41 /app/backend.py | |
parent | e6c88107426c589157f61292d67bacc76320fb7b (diff) | |
download | klausuren-21f1860d598a2df4a5b97c624a18abc4ed9e1675.tar.gz klausuren-21f1860d598a2df4a5b97c624a18abc4ed9e1675.tar.bz2 klausuren-21f1860d598a2df4a5b97c624a18abc4ed9e1675.zip |
Update to Python3
Diffstat (limited to 'app/backend.py')
-rw-r--r-- | app/backend.py | 15 |
1 files changed, 4 insertions, 11 deletions
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 |