本文整理汇总了Python中indico.modules.ModuleHolder类的典型用法代码示例。如果您正苦于以下问题:Python ModuleHolder类的具体用法?Python ModuleHolder怎么用?Python ModuleHolder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleHolder类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getVars
def getVars(self):
vars = wcomponents.WTemplated.getVars(self)
minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance()
vars['body'] = self._escapeChars(self._page)
vars["isFrontPage"] = self._isFrontPage
vars["isRoomBooking"] = self._isRoomBooking
vars["sideMenu"] = None
if self._sideMenu:
vars["sideMenu"] = self._sideMenu.getHTML()
upcoming = ModuleHolder().getById('upcoming_events')
# if this is the front page, include the
# upcoming event information (if there are any)
if self._isFrontPage:
upcoming_list = upcoming.getUpcomingEventList()
if upcoming_list:
vars["upcomingEvents"] = WUpcomingEvents(self._timezone, upcoming_list).getHTML(vars)
else:
vars["upcomingEvents"] = ''
vars["navigation"] = ""
if self._navigation:
vars["navigation"] = self._navigation.getHTML(vars)
vars["timezone"] = self._timezone
vars["isNewsActive"] = minfo.isNewsActive()
return vars
示例2: getVars
def getVars(self):
vars = WTemplated.getVars(self)
newsModule = ModuleHolder().getById("news")
vars["news"] = newsModule.getNewsItemsList()
vars["tz"] = self._tz
return vars
示例3: _getAnswer
def _getAnswer(self):
newsModule = ModuleHolder().getById("news")
ni = news.NewsItem(self._title, self._content, self._type)
newsModule.addNewsItem(ni)
tz = (
self.getAW().getUser().getTimezone()
) # this is an admin service so user is always logged in (or _checkProtection detects it before)
return ni.fossilize(INewsItemFossil, tz=tz)
示例4: delete_offline_events
def delete_offline_events(dbi, logger):
logger.info("Checking which offline events should be deleted")
offline_events_module = ModuleHolder().getById("offlineEvents")
events = offline_events_module.getOfflineEventIndex()
for conf_requests in events.itervalues():
for req in conf_requests:
if req.status == "Generated" and req.creationTime and \
nowutc() - req.creationTime > timedelta(seconds=MAX_OFFLINE_WEBPAGE_LIFE):
logger.info("Deleting offline req {0}".format(req.id))
offline_events_module.removeOfflineFile(req)
logger.info("Deleted offline req {0}".format(req.id))
示例5: _getAnswer
def _getAnswer(self):
newsModule=ModuleHolder().getById("news")
item=newsModule.getNewsItemById(self._id)
if item:
item.setTitle(self._title)
item.setType(self._type)
item.setContent(self._content)
tz = self.getAW().getUser().getTimezone() #this is an admin service so user is always logged in (or _checkProtection detects it before)
return item.fossilize(INewsItemFossil, tz=tz)
else:
raise Exception("News item does not exist")
示例6: removeOldCSSTemplates
def removeOldCSSTemplates(dbi, withRBDB, prevVersion):
"""
Removing old CSS Templates from events
"""
mod = ModuleHolder().getById('cssTpls')
del mod._cssTpls['template1.css']
del mod._cssTpls['template2.css']
del mod._cssTpls['top_menu.css']
mod._p_changed = 1
dbi.commit()
示例7: _getTabContent
def _getTabContent( self, params ):
tz = timezone(timezoneUtils.DisplayTZ(self._getAW()).getDisplayTZ())
wc = WUpdateNews()
newsModule = ModuleHolder().getById("news")
newslist = fossilize(newsModule.getNewsItemsList(), INewsItemFossil, tz=tz)
newsTypesList = newsModule.getNewsTypesAsDict()
recentDays = newsModule.getRecentDays()
pars = {"newslist": newslist,
"newsTypesList": newsTypesList,
"recentDays": recentDays }
return wc.getHTML( pars )
示例8: getVars
def getVars( self ):
vars = wcomponents.WTemplated.getVars( self )
module = ModuleHolder().getById("upcoming_events")
vars["cacheTTL"] = module.getCacheTTL().seconds/60
vars["numberItems"] = module.getNumberItems()
return vars
示例9: isNew
def isNew(self):
newsModule = ModuleHolder().getById("news")
return self.getCreationDate() + \
timedelta(days=newsModule.getRecentDays()) > nowutc()
示例10: _handleGet
def _handleGet(self):
newsModule = ModuleHolder().getById("news")
return newsModule.getRecentDays()