Back to index

plone3  3.1.7
Public Member Functions | Public Attributes
plone.app.content.batching.Batch Class Reference

List of all members.

Public Member Functions

def __init__
def __len__
def __iter__
def size
def firstpage
def lastpage
def items_not_on_page
def multiple_pages
def has_next
def has_previous
def previouspage
def nextpage
def next_item_count
def navlist
def show_link_to_first
def show_link_to_last
def second_page_not_in_navlist
def islastpage
def previous_pages
def next_pages
def before_last_page_not_in_navlist
def items_on_page

Public Attributes

 items
 pagesize
 pagenumber
 navlistsize
 lastpage

Detailed Description

Definition at line 4 of file batching.py.


Constructor & Destructor Documentation

def plone.app.content.batching.Batch.__init__ (   self,
  items,
  pagesize = 20,
  pagenumber = 1,
  navlistsize = 5 
)

Definition at line 7 of file batching.py.

00007 
00008     def __init__(self, items, pagesize=20, pagenumber=1, navlistsize=5):
00009         self.items = items
00010         self.pagesize = pagesize
00011         self.pagenumber = pagenumber
00012         self.navlistsize = navlistsize

Here is the caller graph for this function:


Member Function Documentation

Definition at line 16 of file batching.py.

00016 
00017     def __iter__(self):
00018         start = (self.pagenumber-1) * self.pagesize
00019         end = start + self.pagesize
00020         return self.items[start:end].__iter__()

Here is the caller graph for this function:

Definition at line 13 of file batching.py.

00013 
00014     def __len__(self):
00015         return len(self.items)

Definition at line 105 of file batching.py.

00105 
00106     def before_last_page_not_in_navlist(self):
00107         return (self.lastpage - 1) not in self.navlist

Here is the call graph for this function:

Definition at line 26 of file batching.py.

00026 
00027     def firstpage(self):
00028         return 1

Definition at line 47 of file batching.py.

00047 
00048     def has_next(self):
00049         return (self.pagenumber * self.pagesize) < self.size

Here is the call graph for this function:

Definition at line 51 of file batching.py.

00051 
00052     def has_previous(self):
00053         return self.pagenumber > 1

Definition at line 93 of file batching.py.

00093 
00094     def islastpage(self):
00095         return self.lastpage == self.pagenumber

Here is the caller graph for this function:

Definition at line 37 of file batching.py.

00037 
00038     def items_not_on_page(self):
00039         items_on_page = list(self)
00040         return [item for item in self.items if item not in
00041                 items_on_page]

Definition at line 109 of file batching.py.

00109 
00110     def items_on_page(self):
00111         if self.islastpage:
00112             remainder = self.size % self.pagesize
00113             if remainder == 0:
00114                 return self.pagesize
00115             else:
00116                 return remainder
00117         else:
00118             return self.pagesize

Here is the call graph for this function:

Definition at line 30 of file batching.py.

00030 
00031     def lastpage(self):
00032         pages = self.size / self.pagesize
00033         if self.size % self.pagesize:
00034             pages += 1
00035         return pages

Here is the call graph for this function:

Definition at line 43 of file batching.py.

00043 
00044     def multiple_pages(self):
00045         return bool(self.size / self.pagesize)

Here is the call graph for this function:

Definition at line 70 of file batching.py.

00070 
00071     def navlist(self):
00072         start = self.pagenumber - (self.navlistsize / 2)
00073         if start < 1:
00074             start = 1
00075         end = start + self.navlistsize - 1
00076         if end > self.lastpage:
00077             end = self.lastpage
00078 
00079         return range(start, end+1)

Here is the caller graph for this function:

Definition at line 63 of file batching.py.

00063 
00064     def next_item_count(self):
00065         nextitems = self.size - (self.pagenumber * self.pagesize)
00066         if nextitems > self.pagesize:
00067             return self.pagesize
00068         return nextitems

Here is the call graph for this function:

Definition at line 101 of file batching.py.

00101 
00102     def next_pages(self):
00103         return self.navlist[self.navlist.index(self.pagenumber)+1:]

Here is the call graph for this function:

Definition at line 59 of file batching.py.

00059 
00060     def nextpage(self):
00061         return self.pagenumber + 1

Definition at line 97 of file batching.py.

00097 
00098     def previous_pages(self):
00099         return self.navlist[:self.navlist.index(self.pagenumber)]

Here is the call graph for this function:

Definition at line 55 of file batching.py.

00055 
00056     def previouspage(self):
00057         return self.pagenumber - 1

Definition at line 89 of file batching.py.

00089 
00090     def second_page_not_in_navlist(self):
00091         return 2 not in self.navlist

Here is the call graph for this function:

Definition at line 81 of file batching.py.

00081 
00082     def show_link_to_first(self):
00083         return 1 not in self.navlist

Here is the call graph for this function:

Definition at line 85 of file batching.py.

00085 
00086     def show_link_to_last(self):
00087         return self.lastpage not in self.navlist

Here is the call graph for this function:

Definition at line 22 of file batching.py.

00022 
00023     def size(self):
00024         return len(self)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 8 of file batching.py.

Definition at line 94 of file batching.py.

Definition at line 11 of file batching.py.

Definition at line 10 of file batching.py.

Definition at line 9 of file batching.py.


The documentation for this class was generated from the following file: