Commit a702aecdae1d47b1482eb6c9f3ceb35cc862d210
1 parent
6531a56e
Exists in
dev
minor
Showing
2 changed files
with
15 additions
and
15 deletions
Show diff stats
perguntations/app.py
@@ -364,9 +364,9 @@ class App: | @@ -364,9 +364,9 @@ class App: | ||
364 | elif cmd == "size": | 364 | elif cmd == "size": |
365 | self._set_screen_area(uid, value) | 365 | self._set_screen_area(uid, value) |
366 | elif cmd == "update_answer": | 366 | elif cmd == "update_answer": |
367 | - print(cmd, value) # FIXME | 367 | + print(cmd, value) # FIXME: |
368 | elif cmd == "lint": | 368 | elif cmd == "lint": |
369 | - print(cmd, value) # FIXME | 369 | + print(cmd, value) # FIXME: |
370 | 370 | ||
371 | # ======================================================================== | 371 | # ======================================================================== |
372 | # GETTERS | 372 | # GETTERS |
perguntations/initdb.py
@@ -179,30 +179,30 @@ def main(): | @@ -179,30 +179,30 @@ def main(): | ||
179 | # --- insert new students | 179 | # --- insert new students |
180 | if students: | 180 | if students: |
181 | if args.pw is None: | 181 | if args.pw is None: |
182 | - print('Set passwords to empty') | 182 | + print("Set passwords to empty") |
183 | for s in students: | 183 | for s in students: |
184 | - s['pw'] = '' | 184 | + s["pw"] = "" |
185 | else: | 185 | else: |
186 | - print('Generating password hashes') | 186 | + print("Generating password hashes") |
187 | for s in students: | 187 | for s in students: |
188 | - s['pw'] = ph.hash(args.pw) | ||
189 | - print('.', end='', flush=True) | ||
190 | - print(f'\nInserting {len(students)}') | 188 | + s["pw"] = ph.hash(args.pw) |
189 | + print(".", end="", flush=True) | ||
190 | + print(f"\nInserting {len(students)}") | ||
191 | insert_students_into_db(session, students) | 191 | insert_students_into_db(session, students) |
192 | 192 | ||
193 | # --- update all students | 193 | # --- update all students |
194 | if args.update_all: | 194 | if args.update_all: |
195 | - query = select(Student).where(Student.id != '0') | 195 | + query = select(Student).where(Student.id != "0") |
196 | all_students = session.execute(query).scalars().all() | 196 | all_students = session.execute(query).scalars().all() |
197 | if args.pw is None: | 197 | if args.pw is None: |
198 | - print(f'Resetting password of {len(all_students)} users') | 198 | + print(f"Resetting password of {len(all_students)} users") |
199 | for student in all_students: | 199 | for student in all_students: |
200 | student.password = '' | 200 | student.password = '' |
201 | else: | 201 | else: |
202 | - print(f'Updating password of {len(all_students)} users') | 202 | + print(f"Updating password of {len(all_students)} users") |
203 | for student in all_students: | 203 | for student in all_students: |
204 | student.password = ph.hash(args.pw) | 204 | student.password = ph.hash(args.pw) |
205 | - print('.', end='', flush=True) | 205 | + print(".", end="", flush=True) |
206 | print() | 206 | print() |
207 | session.commit() | 207 | session.commit() |
208 | 208 | ||
@@ -212,10 +212,10 @@ def main(): | @@ -212,10 +212,10 @@ def main(): | ||
212 | query = select(Student).where(Student.id == student_id) | 212 | query = select(Student).where(Student.id == student_id) |
213 | student = session.execute(query).scalar_one() | 213 | student = session.execute(query).scalar_one() |
214 | if args.pw is None: | 214 | if args.pw is None: |
215 | - print(f'Resetting password of user {student_id}') | ||
216 | - student.password = '' | 215 | + print(f"Resetting password of user {student_id}") |
216 | + student.password = "" | ||
217 | else: | 217 | else: |
218 | - print(f'Updating password of user {student_id}') | 218 | + print(f"Updating password of user {student_id}") |
219 | student.password = ph.hash(args.pw) | 219 | student.password = ph.hash(args.pw) |
220 | session.commit() | 220 | session.commit() |
221 | 221 |
-
mentioned in commit cc91e4c034aa4336bad33042438dd98d4f20d958