def get_data_from_context(context): """Get the django paginator data object from the given *context*. The context is a dict-like object. If the context key ``endless`` is not found, a *PaginationError* is raised. """ try: return context['endless'] except KeyError: raise exceptions.PaginationError( 'Cannot find endless data in context.')
def get_page_from_context(context): """ Get the django paginator page object from a *context* (a dict like object). If the context key "endless_page" is not found, a PaginationError is raised. """ try: return context["endless_page"] except KeyError: raise exceptions.PaginationError( "Cannot find endless page in context.")