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] templateFile = '%s_%s.html' % (self.page, self.values['subpage']) self.template = os.path.join(self.templates, templateFile)
def InitLogging(self): import util FORMAT = '%(asctime)s [%(levelname)s] [%(name)s::%(funcName)s] %(message)s' logging.basicConfig(format=FORMAT, level=logging.INFO) # frozen by PyInstaller, redirect log to DbgView on Windows if not util.is_dev() and sys.platform == 'win32': h = logging.StreamHandler(util.DbgViewStream()) h.setLevel(logging.INFO) h.setFormatter(logging.Formatter(FORMAT)) root_logger = logging.getLogger() root_logger.addHandler(h)
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})
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] templateFile = "%s_%s.html" % (self.page, self.values["subpage"]) self.template = os.path.join(self.templates, templateFile)
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] templateFile = '%s_%s.html' % (self.page, self.values['subpage']) self.template = os.path.join(self.templates, templateFile)
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})
# The WSGI entry-point for App Engine Console # import os import re import sys import code import logging from os.path import join, dirname sys.path.insert(0, dirname(__file__)) sys.path.insert(0, dirname(dirname(__file__))) import util import controller from google.appengine.ext import webapp debug = util.is_dev() app = 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)
# You should have received a copy of the GNU General Public License # along with App Engine Console; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import os import re import sys import code import logging from os.path import join, dirname sys.path.insert(0, dirname(__file__)) sys.path.insert(0, dirname(dirname(__file__))) import util import controller # import webapp2 debug = util.is_dev() app = webapp2.WSGIApplication([ ('/', controller.Root), ('/console/dashboard/', controller.Dashboard), ('/console/help.*', controller.Help), ('/console/statement', controller.Statement), ('/console/banner', controller.Banner), ('/console.*', controller.Console), ], debug=debug)
import os import timezone import util import yaml is_dev = util.is_dev() is_prod = not is_dev debug = is_dev timezone = timezone.Pacific jquery = '//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js' jquery_ui = '//ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js' reset_css = '//developer.yahoo.com/yui/build/reset/reset.css' favicon = '//images.yelp.com/favicon.ico' mail_host = 'yelp-pushmaster.appspotmail.com' mail_sender = 'app@' + mail_host mail_to = '*****@*****.**' hostname = 'yelp-pushmaster.appspot.com' if is_prod else 'localhost:8080' protocol = 'http' push_plans_url = 'https://trac.yelpcorp.com/wiki/YelpPushPlans' static_host_count = 4 git_branch_url = 'https://gitweb.yelpcorp.com/?p=yelp-main.git;a=log;h=refs/heads/%(branch)s' def url(path): return '%s://%s%s' % (protocol, hostname, path) def static_host(path): return '%d.%s' % (hash(path) % static_host_count, hostname) report_users = yaml.load(file(os.path.join(os.path.dirname(__file__), '..', 'report_users.yaml')))['report_users']