def __init__(self, req,createContent=True,preCreate=True,parent=None): BaseController.__init__(self,req,False,parent=parent) self.parent = None if isinstance(parent,StatmonController): self.parent = parent if not createContent: return self.preCreate() self.createContent() self.postCreate()
def createContent(self): global _hasExtraCSS self.addStyleSheet(self.homePrefixIt('css/statmon.css',cwd=currentPath),'normal',sheetClass='statmon') self.addStyleSheet(self.homePrefixIt('css/print.css',cwd=currentPath),'print',sheetClass='statmon',sheetMedia='print') if _hasExtraCSS == None: if os.path.exists(os.path.abspath(currentPath+_extraCSS)): _hasExtraCSS = True else: _hasExtraCSS = False if _hasExtraCSS: self.addStyleSheet(self.homePrefixIt(_extraCSS,cwd=currentPath)) #if configStatmonInternal('.failedToLoad').getValue(): #self.injectedContent = FailedReadConfigController(self.req) BaseController.createContent(self)
def postCreate(self): BaseController.postCreate(self) # Create Alerts alerts=self.getAlerts(local=True) self.alertTable = AlertController(self.req,alerts) if self._splitAlerts: self.alertTables = [] splits = self._splitAlerts from math import ceil for i in range(splits): start = int(ceil(i*len(alerts)/float(splits))) end = int(ceil((i+1)*len(alerts)/float(splits))) if end-start: alertTable = AlertController(self.req,alerts[start:end],number=i+1,of=splits) self.alertTables.append( alertTable )
def preCreate(self): BaseController.preCreate(self) self.accessControl()