示例#1
0
    def index(self):
        """
        Render the history page.

        [Converted to VueRouter]
        """
        t = PageTemplate(rh=self, filename='index.mako')
        return t.render()
示例#2
0
 def get(self, *args, **kwargs):
     """
     Render the Login page
     """
     if self.get_current_user():
         self.redirect('/{page}/'.format(page=app.DEFAULT_PAGE))
     else:
         t = PageTemplate(rh=self, filename='login.mako')
         self.finish(t.render(title='Login', header='Login', topmenu='login'))
示例#3
0
    def index(self):
        next_week = datetime.date.today() + datetime.timedelta(days=7)
        next_week1 = datetime.datetime.combine(next_week, datetime.time(tzinfo=network_timezones.app_timezone))
        results = ComingEpisodes.get_coming_episodes(ComingEpisodes.categories, app.COMING_EPS_SORT, False)
        today = datetime.datetime.now().replace(tzinfo=network_timezones.app_timezone)

        t = PageTemplate(rh=self, filename='schedule.mako')
        return t.render(next_week=next_week1, today=today, results=results,
                        layout=app.COMING_EPS_LAYOUT, controller='schedule', action='index')
示例#4
0
    def index(self, level=logging.ERROR, **kwargs):
        """Render default index page."""
        try:
            level = int(level)
        except (TypeError, ValueError):
            level = logging.ERROR

        t = PageTemplate(rh=self, filename='errorlogs.mako')
        return t.render(logLevel=level, controller='errorlogs', action='index')
示例#5
0
    def index(self, level=logging.ERROR, **kwargs):
        """Render default index page."""
        try:
            level = int(level)
        except (TypeError, ValueError):
            level = logging.ERROR

        t = PageTemplate(rh=self, filename='errorlogs.mako')
        return t.render(submenu=self._create_menu(level), logLevel=level,
                        controller='errorlogs', action='index')
示例#6
0
    def get(self, *args, **kwargs):
        """
        Render the Login page

        [Converted to VueRouter]
        """
        if self.get_current_user():
            self.redirect('/{page}/'.format(page=app.DEFAULT_PAGE))
        else:
            t = PageTemplate(rh=self, filename='index.mako')
            self.finish(t.render())
示例#7
0
    def get(self, *args, **kwargs):
        """
        Render the Login page

        [Converted to VueRouter]
        """
        if self.get_current_user():
            self.redirect('/{page}/'.format(page=app.DEFAULT_PAGE))
        else:
            t = PageTemplate(rh=self, filename='index.mako')
            self.finish(t.render())
示例#8
0
    def index(self):
        """
        Render the schedule page.

        [Converted to VueRouter]
        """
        return PageTemplate(rh=self, filename='index.mako').render()
示例#9
0
    def viewlog(self, **kwargs):
        """
        Render the log viewer page.

        [Converted to VueRouter]
        """
        return PageTemplate(rh=self, filename='index.mako').render()
示例#10
0
    def index(self, **kwargs):
        """
        Render template for route /errorlogs.

        [Converted to VueRouter]
        """
        return PageTemplate(rh=self, filename='index.mako').render()
示例#11
0
    def index(self):
        next_week = datetime.date.today() + datetime.timedelta(days=7)
        next_week1 = datetime.datetime.combine(
            next_week, datetime.time(tzinfo=network_timezones.app_timezone))
        results = ComingEpisodes.get_coming_episodes(ComingEpisodes.categories,
                                                     app.COMING_EPS_SORT,
                                                     False)
        today = datetime.datetime.now().replace(
            tzinfo=network_timezones.app_timezone)

        submenu = [
            {
                'title': 'Sort by:',
                'path': {
                    'Date': 'schedule/setScheduleSort/?sort=date',
                    'Show': 'schedule/setScheduleSort/?sort=show',
                    'Network': 'schedule/setScheduleSort/?sort=network',
                }
            },
            {
                'title': 'Layout:',
                'path': {
                    'Banner': 'schedule/setScheduleLayout/?layout=banner',
                    'Poster': 'schedule/setScheduleLayout/?layout=poster',
                    'List': 'schedule/setScheduleLayout/?layout=list',
                    'Calendar': 'schedule/setScheduleLayout/?layout=calendar',
                }
            },
            {
                'title': 'View Paused:',
                'path': {
                    'Hide': 'schedule/toggleScheduleDisplayPaused'
                } if app.COMING_EPS_DISPLAY_PAUSED else {
                    'Show': 'schedule/toggleScheduleDisplayPaused'
                }
            },
        ]

        t = PageTemplate(rh=self, filename='schedule.mako')
        return t.render(submenu=submenu[::-1],
                        next_week=next_week1,
                        today=today,
                        results=results,
                        layout=app.COMING_EPS_LAYOUT,
                        topmenu='schedule',
                        controller='schedule',
                        action='index')
示例#12
0
文件: history.py 项目: MatyasK/Medusa
    def index(self, limit=None):
        if limit is None:
            if app.HISTORY_LIMIT:
                limit = int(app.HISTORY_LIMIT)
            else:
                limit = 100
        else:
            limit = try_int(limit, 100)

        app.HISTORY_LIMIT = limit

        app.instance.save_config()

        history = self.history.get(limit)

        t = PageTemplate(rh=self, filename='history.mako')
        return t.render(historyResults=history.detailed, compactResults=history.compact, limit=limit,
                        controller='history', action='index')
示例#13
0
    def viewlog(self,
                min_level=logging.INFO,
                log_filter=None,
                log_search=None,
                max_lines=1000,
                log_period='one_day',
                text_view=None,
                **kwargs):
        """View the log given the specified filters."""
        # @TODO: Replace index with this or merge it so ?search=true or ?query={queryString} enables this "view"
        min_level = int(min_level)
        log_filter = log_filter if log_filter in log_name_filters else None

        t = PageTemplate(rh=self, filename='viewlogs.mako')

        period = log_periods.get(log_period)
        modification_time = datetime.now() - period if period else None
        data = [
            line for line in read_loglines(
                modification_time=modification_time,
                formatter=text_type,
                max_lines=max_lines,
                predicate=lambda l: filter_logline(l,
                                                   min_level=min_level,
                                                   thread_name=thread_names.
                                                   get(log_filter, log_filter),
                                                   search_query=log_search))
        ]

        if not text_view:
            return t.render(topmenu='system',
                            log_lines='\n'.join(
                                [html_escape(line) for line in data]),
                            min_level=min_level,
                            log_name_filters=log_name_filters,
                            log_filter=log_filter,
                            log_search=log_search,
                            log_period=log_period,
                            controller='errorlogs',
                            action='viewlogs')
        else:
            return '<br/>'.join([html_escape(line) for line in data])
示例#14
0
    def index(self, limit=None):
        if limit is None:
            if app.HISTORY_LIMIT:
                limit = int(app.HISTORY_LIMIT)
            else:
                limit = 100
        else:
            limit = try_int(limit, 100)

        app.HISTORY_LIMIT = limit

        app.instance.save_config()

        history = self.history.get(limit)

        t = PageTemplate(rh=self, filename='history.mako')
        submenu = [
            {
                'title': 'Clear History',
                'path': 'history/clearHistory',
                'icon': 'ui-icon ui-icon-trash',
                'class': 'clearhistory',
                'confirm': True
            },
            {
                'title': 'Trim History',
                'path': 'history/trimHistory',
                'icon': 'menu-icon-cut',
                'class': 'trimhistory',
                'confirm': True
            },
        ]

        return t.render(historyResults=history.detailed,
                        compactResults=history.compact,
                        limit=limit,
                        submenu=submenu[::-1],
                        topmenu='history',
                        controller='history',
                        action='index')
示例#15
0
    def viewlog(self, min_level=logging.INFO, log_filter=None, log_search=None, max_lines=1000, log_period='one_day',
                text_view=None, **kwargs):
        """View the log given the specified filters."""
        # @TODO: Replace index with this or merge it so ?search=true or ?query={queryString} enables this "view"
        min_level = int(min_level)
        log_filter = log_filter if log_filter in log_name_filters else None

        t = PageTemplate(rh=self, filename='viewlogs.mako')

        period = log_periods.get(log_period)
        modification_time = datetime.now() - period if period else None
        data = (html_escape(line) for line in read_loglines(modification_time=modification_time, formatter=text_type, max_lines=max_lines,
                                                            predicate=lambda l: filter_logline(l, min_level=min_level,
                                                                                               thread_name=thread_names.get(log_filter, log_filter),
                                                                                               search_query=log_search)))

        if not text_view:
            return t.render(log_lines='\n'.join(data),
                            min_level=min_level, log_name_filters=log_name_filters, log_filter=log_filter, log_search=log_search, log_period=log_period,
                            controller='errorlogs', action='viewlogs')
        else:
            return '<br/>'.join(data)
示例#16
0
    def index(self, limit=None):
        if limit is None:
            if app.HISTORY_LIMIT:
                limit = int(app.HISTORY_LIMIT)
            else:
                limit = 100
        else:
            limit = try_int(limit, 100)

        app.HISTORY_LIMIT = limit

        app.instance.save_config()

        history = self.history.get(limit)

        t = PageTemplate(rh=self, filename='history.mako')
        submenu = [
            {'title': 'Clear History', 'path': 'history/clearHistory', 'icon': 'ui-icon ui-icon-trash', 'class': 'clearhistory', 'confirm': True},
            {'title': 'Trim History', 'path': 'history/trimHistory', 'icon': 'menu-icon-cut', 'class': 'trimhistory', 'confirm': True},
        ]

        return t.render(historyResults=history.detailed, compactResults=history.compact, limit=limit,
                        submenu=submenu[::-1], controller='history', action='index')
示例#17
0
 def index(self):
     """[Converted to VueRouter]."""
     t = PageTemplate(rh=self, filename='index.mako')
     return t.render()