Пример #1
0
    def get(self):
        if util.is_dev():
            options = ['Development', 'Production']
            #self.values['dashboard_url'] = '/_ah/admin'
            #self.values['settings'] = [ {'type':'link', 'name':'Production Dashboard',
        else:
            options = ['Production', 'Development']

        self.values['settings'] = [
            {'id':'dash_type', 'options':options},
            {'type':'hidden', 'id':'dash_url_pro', 'value':'http://appengine.google.com/dashboard?app_id=%s' % self.appID },
            {'type':'hidden', 'id':'dash_url_dev', 'value':'/_ah/admin'},
        ]

        # Provide a view of Google Analytics if possible.
        if config.analytics_id:
            options.append('Analytics')
            self.values['settings'].append({'type':'hidden', 'id':'dash_url_analytics', 'value':config.analytics_id})
Пример #2
0
    def __init__(self, *args, **kw):
        ConsoleHandler.__init__(self, *args, **kw)
        self.do_get = self.get
        self.get = self.wrap_get

        myClass = re.search(r"<class '.*\.(.*)'", str(self.__class__)).groups()[0]
        self.page = myClass.lower()

        path = os.environ['PATH_INFO']

        self.values = {}
        self.values['app']        = self.appID
        self.values['path']       = path
        self.values['admin']      = users.is_current_user_admin()
        self.values['is_dev']     = util.is_dev()
        self.values['log_in']     = users.create_login_url(path)
        self.values['log_out']    = users.create_logout_url(path)
        self.values['version']    = self.appVersion
        self.values['subpages']   = self.subpages
        self.values['controller'] = self.page.capitalize()

        self.values['pages']    = [ {'name':'Console'   , 'href':'/console/'},
                                    {'name':'Dashboard' , 'href':'/console/dashboard/'},
                                    {'name':'Help'      , 'href':'/console/help/'},
                                  ]

        #if util.is_my_website():
        #    self.values['my_website'] = True
        #    self.values['app'] = 'App Engine Console'
        #    self.values['version'] = re.sub(r'\.\d$', '', self.values['version'])

        match = re.search(r'^/console/%s/(.+)$' % self.page, path)
        if match:
            # Handle a sub-path which is within the main controller path (e.g. /help/something instead of just /help).
            self.values['subpage'] = match.groups()[0]
        else:
            self.values['subpage'] = ''
            if self.subpages:
                # The default sub-page is the first one in the list.
                self.values['subpage'] = self.subpages[0]

        self.template = \
            'console/%s_%s.html' % (self.page, self.values['subpage'])
Пример #3
0
import sys
import cgi
import code
import logging

from os.path import join, dirname
sys.path.insert(0, dirname(__file__))
sys.path.insert(0, dirname(dirname(__file__)))

import consoleutil as util
import controller

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app

debug = util.is_dev()
application = webapp.WSGIApplication([
    ('/'                  , controller.Root),
    ('/console/dashboard/', controller.Dashboard),
    ('/console/help.*'    , controller.Help),
    ('/console/statement' , controller.Statement),
    ('/console/banner'    , controller.Banner),
    ('/console.*'         , controller.Console),
], debug=debug)

def main():
    if debug:
        logging.getLogger().setLevel(logging.DEBUG)
    run_wsgi_app(application)

if __name__ == "__main__":