diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/backend.py | 15 | ||||
-rw-r--r-- | app/forms.py | 2 | ||||
-rw-r--r-- | app/main.py | 2 |
3 files changed, 6 insertions, 13 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 diff --git a/app/forms.py b/app/forms.py index 2870fca..94e9947 100644 --- a/app/forms.py +++ b/app/forms.py @@ -8,7 +8,7 @@ from wtforms.validators import ValidationError year_start = date.today().year year_end = current_app.config['FORM_START_YEAR']-1 -choices = [(str(x),x) for x in xrange(year_start, year_end, -1)] +choices = [(str(x),x) for x in range(year_start, year_end, -1)] class UploadForm(Form): """ Upload Form class for validation """ study = TextField('Studiengang') diff --git a/app/main.py b/app/main.py index 180715e..0ca0d2a 100644 --- a/app/main.py +++ b/app/main.py @@ -36,7 +36,7 @@ def upload(study, course = None): # dynamically fill form values courses = set(current_app.config['STUDIES'][study] + get_studies()[study].get_courses()) - choices = [(k,k) for k in sorted(courses, key=unicode.lower)] + choices = [(k,k) for k in sorted(courses, key=str.casefold)] form.course.choices = choices if 'new' not in dict(form.course.choices): form.course.choices.append(('', u'---')) |