Commits

Mark Lavin  committed aad3c06

Use get for all dictionary lookups.

  • Participants
  • Parent commits 075543c
  • Branches result-refactor

Comments (0)

Files changed (1)

File selectable/base.py

 
     def paginate_results(self, results, options):
         "Return a django.core.paginator.Page of results."
-        limit = options['limit']
+        limit = options.get('limit', settings.SELECTABLE_MAX_LIMIT)
         paginator = Paginator(results, limit)        
         page = options.get('page', 1)
         try:
         form = self.form(request.GET)
         if form.is_valid():
             options = form.cleaned_data
-            term = options['term']
+            term = options.get('term', '')
             raw_data = self.get_query(request, term)
             results = self.format_results(raw_data, options)
         content = self.serialize_results(results)