def paint(self, search=False, single=False, status=None, curIndex=0, onlyChildren=False): if status is None: if search: status = [common.TEMP] else: status = common.getHomeStatuses() if self.manager.download.__name__ == self.type and self.status not in status: return '' if not onlyChildren: html = self.buildHtml(search, curIndex=curIndex) else: html = '{{children}}' if single: return html children = Element.select().where(Element.parent == self.id) curIndex = 0 if '{{children}}' in html: for child in sorted(children, key=lambda c: c.orderFieldValues): html = html.replace( '{{children}}', '%s{{children}}' % child.paint(search=search, single=single, status=status, curIndex=curIndex), 1) curIndex += 1 html = html.replace('{{children}}', '') return html
def paint(self, search=False, single=False, status=None, curIndex=0, onlyChildren=False): if status is None: if search: status = [common.TEMP] else: status = common.getHomeStatuses() if self.manager.download.__name__ == self.type and self.status not in status: return '' if not onlyChildren: html = self.buildHtml(search, curIndex=curIndex) else: html = '{{children}}' if single: return html children = Element.select().where(Element.parent == self.id) curIndex = 0 orderReverse = False if children.count(): orderReverse = children.first().orderReverse if '{{children}}' in html: for child in sorted(children, key=lambda c: c.orderFieldValues, reverse=orderReverse ): html = html.replace('{{children}}', '%s{{children}}' % child.paint(search=search, single=single, status=status, curIndex=curIndex), 1) curIndex += 1 html = html.replace('{{children}}', '') return html
def paint(self, search=False, single=False, status=None, curIndex=0, onlyChildren=False): if status is None: if search: status = [common.TEMP] else: status = common.getHomeStatuses() if self.manager.download.__name__ == self.type and self.status not in status: return "" if not onlyChildren: html = self.buildHtml(search, curIndex=curIndex) else: html = "{{children}}" if single: return html children = Element.select().where(Element.parent == self.id) curIndex = 0 if "{{children}}" in html: for child in sorted(children, key=lambda c: c.orderFieldValues): html = html.replace( "{{children}}", "%s{{children}}" % child.paint(search=search, single=single, status=status, curIndex=curIndex), 1, ) curIndex += 1 html = html.replace("{{children}}", "") return html
def paint(self, root=None, status=None): if status is None: status = common.getHomeStatuses() if root is None: log('init paint on default root %s %s' % (self.root, self.root.id)) return self.root.paint(status=status) else: log('init paint on given root %s %s' % (root, root.id)) return root.paint(search=True)
def paint(self, root=None, status=None): if status is None: status = common.getHomeStatuses() if root is None: log('init paint on default root %s' % self.root) return self.root.paint(status=status) else: log('init paint on given root %s' % root) return root.paint(search=True)
def homeStatuses(self): return common.getHomeStatuses()
def getDownloadableElements(self, asList=True): return self.getElementsWithStatusIn(common.getHomeStatuses(), asList, [self.download.__name__])