Oktay Sancak avatar Oktay Sancak committed 52e38a3

Minor refactoring

Comments (0)

Files changed (1)

storages/backends/database.py

     raise ImproperlyConfigured, "Could not load pyodbc dependency.\
     \nSee http://code.google.com/p/pyodbc/"
 
+REQUIRED_FIELDS = ('db_table', 'fname_column', 'blob_column', 'size_column', 'base_url')
 
 class DatabaseStorage(Storage):
     """
             Url prefix used with filenames. Should be mapped to the view,
 that returns an image as result. 
         """
-        
-        if not option or not (option.has_key('db_table') and option.has_key('fname_column') and option.has_key('blob_column')
-                              and option.has_key('size_column') and option.has_key('base_url') ):
+
+        if not option or not all([field in option for field in REQUIRED_FIELDS]):
             raise ValueError("You didn't specify required options")
+
         self.db_table = option['db_table']
         self.fname_column = option['fname_column']
         self.blob_column = option['blob_column']
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.