def process_request(self, req): """ Render welcome page """ # Prepare data for template prjs = Projects() data = {} data['baseurl'] = conf.url_projects_path if req.authname == 'anonymous': conf.redirect(req) # Get project count data['project_count'] = prjs.project_count() user = get_userstore().getUser(req.authname) global_timeline = GlobalTimeline() data['show_explore'] = self.env[FindProjectsModule].has_explore_perm(req) data['latest_events'] = global_timeline.get_latest_events(req.authname, 5) # Check if user is allowed to create project data['can_create_project'] = user.can_create_project() # Configuration values the welcome page wants data['site_name'] = conf.site_name data['site_title_text'] = conf.site_title_text data['site_punch_line'] = conf.punch_line data['site_theme_path'] = conf.getThemePath() wiki_welcome = self._get_welcome_page(req) if wiki_welcome: data['wiki_welcome'] = wiki_welcome return "welcome.html", data, None
def main(options): """ :param options: optparse options """ tl = GlobalTimeline() # Update last 24 hours for every hour (this makes sure we will not miss any events) tl.refresh_today(update=options.update) # Clean up old events from the timeline. For now we keep only last 60 days. tl.clean_up(days_to_keep=options.days) # Clear cache cache = TimelineCache() cache.clear()
def process_request(self, req): """ Render welcome page """ # Prepare data for template prjs = Projects() data = {} data['baseurl'] = conf.url_projects_path if req.authname == 'anonymous': conf.redirect(req) # Get project count data['project_count'] = prjs.project_count() user = get_userstore().getUser(req.authname) global_timeline = GlobalTimeline() data['show_explore'] = self.env[FindProjectsModule].has_explore_perm( req) data['latest_events'] = global_timeline.get_latest_events( req.authname, 5) # Check if user is allowed to create project data['can_create_project'] = user.can_create_project() # Configuration values the welcome page wants data['site_name'] = conf.site_name data['site_title_text'] = conf.site_title_text data['site_punch_line'] = conf.punch_line data['site_theme_path'] = conf.getThemePath() wiki_welcome = self._get_welcome_page(req) if wiki_welcome: data['wiki_welcome'] = wiki_welcome return "welcome.html", data, None
def _notify_event_occurred(project_identifier, event_type): """ This function will notify / invoke actions about the fact that anything happened in a project For now implemented here. In the future could be extensible through some interface. """ from multiproject.home.timeline.api import GlobalTimeline gtl = GlobalTimeline() now = datetime.datetime.now(datefmt.localtz) update = False filters = None # Two hours back should be more than enough and also take one # hour to the future to make absolute sure that event is not missed past = now - datetime.timedelta(hours = 2) # Previously, if files events were noticed, the whole cache was updated. # That seemed to be too heavy operation to clear all events when files tab is updated. # Let's just accept, that there might be broken links in global timeline cache. future = now + datetime.timedelta(hours = 1) gtl.refresh_project(project_identifier, past, future, filters, update) cache = TimelineCache() cache.clear()
def _notify_event_occurred(project_identifier, event_type): """ This function will notify / invoke actions about the fact that anything happened in a project For now implemented here. In the future could be extensible through some interface. """ from multiproject.home.timeline.api import GlobalTimeline gtl = GlobalTimeline() now = datetime.datetime.now(datefmt.localtz) update = False filters = None # Two hours back should be more than enough and also take one # hour to the future to make absolute sure that event is not missed past = now - datetime.timedelta(hours=2) # Previously, if files events were noticed, the whole cache was updated. # That seemed to be too heavy operation to clear all events when files tab is updated. # Let's just accept, that there might be broken links in global timeline cache. future = now + datetime.timedelta(hours=1) gtl.refresh_project(project_identifier, past, future, filters, update) cache = TimelineCache() cache.clear()
def _get_latest_events(self, req): tl = GlobalTimeline() return tl.get_latest_events(req.authname, 150)