1. jerzyk
  2. django-storages

Commits

Janusz Harkot  committed 320293c

handle null value

  • Participants
  • Parent commits 388ba0a
  • Branches default

Comments (0)

Files changed (1)

File storages/backends/ftp.py

View file
  • Ignore whitespace
         return self._size
 
     def read(self, num_bytes=None):
+        if not num_bytes:
+            return None
+
         if not self._is_read:
             self._storage._start_connection()
             self.file = self._storage._read(self._name)
             self._storage._end_connection()
             self._is_read = True
 
-        if num_bytes:
-            return self.file.read(num_bytes)
-        else:
-            return None
+        return self.file.read(num_bytes)
 
     def write(self, content):
         if 'w' not in self._mode: