summaryrefslogtreecommitdiffstats
path: root/app/backend.py
diff options
context:
space:
mode:
Diffstat (limited to 'app/backend.py')
-rw-r--r--app/backend.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/app/backend.py b/app/backend.py
index 25a5506..6c59edd 100644
--- a/app/backend.py
+++ b/app/backend.py
@@ -28,7 +28,12 @@ class Storage:
year = splitted[-1]
module = splitted[-2]
if year.isdigit():
- yield((year, files))#, os.path.join(root,f))
+ yield (year, files)
- def add_file(self, data, path):
- pass
+ def add_file(self, module, year, filename, data):
+ dir_name = self._join(module, year)
+ if not os.path.exists(dir_name):
+ os.makedirs(dir_name)
+ path = self._join(module, year, filename)
+ with open(path, 'wb') as f:
+ f.write(data)