This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pagination.py | |
class Paginator(object): | |
def __init__(self, query, per_page): | |
"""Initialize a paginator. | |
Arguments: | |
- query -- queryset from pymongo or mongoengine | |
- per_page -- number of items per page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
#-*- coding: utf-8 -*- | |
""" | |
Use it by setting CACHE_BACKEND in settings.py, e.g.: | |
CACHE_BACKEND = 'utils.backends.cache.pylibmcd://127.0.0.1:11211/' | |
NEW: can be transmit pylibmc cache behaviors to cache backend | |
for example: |