def manage(self, app, action, **kwargs):
        ''' return the headlines management template'''
 
        user = cherrypy.session['user']['name'] 
        host_app = cherrypy.request.path_info.split('/')[3]

        headlines = Headlines.all()
        headlines = headlines.filter_by_app(app)
   
        return self.render_template('/%s:/templates/headlines_manage.html' % host_app,
                                    dict(headlines=headlines, app=app))
    def manage(self, app, action, **kwargs):
        ''' return the headlines management template'''

        user = cherrypy.session['user']['name']
        host_app = cherrypy.request.path_info.split('/')[3]

        headlines = Headlines.all()
        headlines = headlines.filter_by_app(app)

        return self.render_template(
            '/%s:/templates/headlines_manage.html' % host_app,
            dict(headlines=headlines, app=app))
    def list(self, app, action, **kwargs):
        ''' return hadoop ops headlines'''

        output = {'headlines': []} 
        user = cherrypy.session['user']['name'] 
        host_app = cherrypy.request.path_info.split('/')[3]

        count = int(kwargs.get('count', '10'))
        earliest = kwargs.get('earliest', None)

        headlines = Headlines.all()
        headlines = headlines.filter_by_app(app)
        headlines = headlines.filter_by_user(user)
      
        output['headlines'] = self.get_headlines_detail(headlines, host_app, user, 
                                                        count, earliest, srtd=True)

        return self.render_json(output)
    def list(self, app, action, **kwargs):
        ''' return hadoop ops headlines'''

        output = {'headlines': []}
        user = cherrypy.session['user']['name']
        host_app = cherrypy.request.path_info.split('/')[3]

        count = int(kwargs.get('count', '10'))
        earliest = kwargs.get('earliest', None)

        headlines = Headlines.all()
        headlines = headlines.filter_by_app(app)
        headlines = headlines.filter_by_user(user)

        output['headlines'] = self.get_headlines_detail(headlines,
                                                        host_app,
                                                        user,
                                                        count,
                                                        earliest,
                                                        srtd=True)

        return self.render_json(output)