This commit is contained in:
str4d
2012-12-19 05:28:01 +00:00
parent 254fab592c
commit 8f9e8fb178

View File

@@ -1,4 +1,17 @@
from math import ceil
from werkzeug import import_string, cached_property
class LazyView(object):
def __init__(self, import_name):
self.__module__, self.__name__ = import_name.rsplit('.', 1)
self.import_name = import_name
@cached_property
def view(self):
return import_string(self.import_name)
def __call__(self, *args, **kwargs):
return self.view(*args, **kwargs)
class Pagination(object):
def __init__(self, page, per_page, total_count):