def little_blocks(self): """ Render all little blocks and return them as string. """ buffer = "" contentItems = self.context.contentItems() # For vertical blocks, we have blocks equal widths # For horizontal blocks, we calculate the width for each little block if self.getDirection() == Block.HORIZONTAL: contentItemsLength = len(contentItems) i = 0 for id, little_block in contentItems: i += 1 view = getViewForLittleBlock(self.request, little_block) view_units = self.units() * little_block.getWeight() / self.total_weight() view.setUnitWidth(view_units) if i == contentItemsLength: view.setIsLast(True) else: view.setIsLast(False) buffer += view() else: #little blocks inside vertical big blocks always get the span width of its container for id, little_block in contentItems: view = getViewForLittleBlock(self.request, little_block) view.setUnitWidth(self.units()) view.setIsLast(False) buffer += view() return buffer
def update(self): self.rendered_view = getViewForLittleBlock(self.request, self.context)