Browse Source

Merge branch 'newlodel' of git.labocleo.org:lodel2 into newlodel

prieto 8 years ago
parent
commit
8e19c286b0
1 changed files with 7 additions and 2 deletions
  1. 7
    2
      plugins/mongodb_datasource/datasource.py

+ 7
- 2
plugins/mongodb_datasource/datasource.py View File

@@ -120,8 +120,13 @@ ordering is not implemented yet")
120 120
                     results, key=operator.itemgetter(*sort_itemgetter_args),
121 121
                     reverse=False if sort_dir == 'ASC' else True)
122 122
             #If limit given apply limit again
123
-            if limit is not None:
124
-                results = results[offset:offset+limit]
123
+            if offset > len(results):
124
+                results = list()
125
+            else:
126
+                if limit is not None:
127
+                    if limit + offset >= len(results):
128
+                        limit = len(results)-offset-1
129
+                    results = results[offset:offset+limit]
125 130
             return results
126 131
         # Default behavior
127 132
         if filters is None:

Loading…
Cancel
Save