Explorar el Código

Added key validation for exporter.export_by_key

Vsevolod Levitan hace 1 año
padre
commit
81ad8b8636
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      src/export/exporter.py

+ 4 - 0
src/export/exporter.py

@@ -26,6 +26,10 @@ class exporter:
     def export_by_key(self, key):
         """Экспортировать модели из storage по ключу"""
 
+        # Проверяем чтобы ключ был строкой с длиной >0
+        self.__vtor.check_type(key, str)
+        self.__vtor.check_length_greater(key, 0)
+
         models = storage().data[key]
 
         return self.export_models(models)