thirdparty/google_appengine/google/appengine/ext/admin/__init__.py
changeset 2864 2e0b0af889be
parent 2413 d0b7dac5325c
equal deleted inserted replaced
2862:27971a13089f 2864:2e0b0af889be
   117       'datastore_batch_edit_path': base_path + DatastoreBatchEditHandler.PATH,
   117       'datastore_batch_edit_path': base_path + DatastoreBatchEditHandler.PATH,
   118       'interactive_path': base_path + InteractivePageHandler.PATH,
   118       'interactive_path': base_path + InteractivePageHandler.PATH,
   119       'interactive_execute_path': base_path + InteractiveExecuteHandler.PATH,
   119       'interactive_execute_path': base_path + InteractiveExecuteHandler.PATH,
   120       'memcache_path': base_path + MemcachePageHandler.PATH,
   120       'memcache_path': base_path + MemcachePageHandler.PATH,
   121       'queues_path': base_path + QueuesPageHandler.PATH,
   121       'queues_path': base_path + QueuesPageHandler.PATH,
       
   122       'xmpp_path': base_path + XMPPPageHandler.PATH,
       
   123       'inboundmail_path': base_path + InboundMailPageHandler.PATH,
   122     }
   124     }
   123     if HAVE_CRON:
   125     if HAVE_CRON:
   124       values['cron_path'] = base_path + CronPageHandler.PATH
   126       values['cron_path'] = base_path + CronPageHandler.PATH
   125 
   127 
   126     values.update(template_values)
   128     values.update(template_values)
   246           job['times'].append({'runtime': match.strftime("%Y-%m-%d %H:%M:%SZ"),
   248           job['times'].append({'runtime': match.strftime("%Y-%m-%d %H:%M:%SZ"),
   247                                'difference': str(match - now)})
   249                                'difference': str(match - now)})
   248     self.generate('cron.html', values)
   250     self.generate('cron.html', values)
   249 
   251 
   250 
   252 
       
   253 class XMPPPageHandler(BaseRequestHandler):
       
   254   """Tests XMPP requests."""
       
   255   PATH = '/xmpp'
       
   256 
       
   257   def get(self):
       
   258     """Shows template displaying the XMPP."""
       
   259     xmpp_configured = True
       
   260     values = {
       
   261       'xmpp_configured': xmpp_configured,
       
   262       'request': self.request
       
   263     }
       
   264     self.generate('xmpp.html', values)
       
   265 
       
   266 
       
   267 class InboundMailPageHandler(BaseRequestHandler):
       
   268   """Tests Mail requests."""
       
   269   PATH = '/inboundmail'
       
   270 
       
   271   def get(self):
       
   272     """Shows template displaying the Inbound Mail form."""
       
   273     inboundmail_configured = True
       
   274     values = {
       
   275       'inboundmail_configured': inboundmail_configured,
       
   276       'request': self.request
       
   277     }
       
   278     self.generate('inboundmail.html', values)
       
   279 
       
   280 
   251 class QueuesPageHandler(BaseRequestHandler):
   281 class QueuesPageHandler(BaseRequestHandler):
   252   """Shows information about configured (and default) task queues."""
   282   """Shows information about configured (and default) task queues."""
   253   PATH = '/queues'
   283   PATH = '/queues'
   254 
   284 
   255   def __init__(self):
   285   def __init__(self):
  1212 for data_type in _DATA_TYPES.values():
  1242 for data_type in _DATA_TYPES.values():
  1213   _NAMED_DATA_TYPES[data_type.name()] = data_type
  1243   _NAMED_DATA_TYPES[data_type.name()] = data_type
  1214 
  1244 
  1215 
  1245 
  1216 def _ParseCronYaml():
  1246 def _ParseCronYaml():
  1217   """Load the cron.yaml file and parse it."""
  1247   """Loads the cron.yaml file and parses it.
       
  1248 
       
  1249   The CWD of the dev_appserver is the root of the application here.
       
  1250 
       
  1251   Returns a dict representing the contents of cron.yaml.
       
  1252   """
  1218   cronyaml_files = 'cron.yaml', 'cron.yml'
  1253   cronyaml_files = 'cron.yaml', 'cron.yml'
  1219   for cronyaml in cronyaml_files:
  1254   for cronyaml in cronyaml_files:
  1220     try:
  1255     try:
  1221       fh = open(cronyaml, "r")
  1256       fh = open(cronyaml, "r")
  1222     except IOError:
  1257     except IOError:
  1238     ('.*' + InteractiveExecuteHandler.PATH, InteractiveExecuteHandler),
  1273     ('.*' + InteractiveExecuteHandler.PATH, InteractiveExecuteHandler),
  1239     ('.*' + MemcachePageHandler.PATH, MemcachePageHandler),
  1274     ('.*' + MemcachePageHandler.PATH, MemcachePageHandler),
  1240     ('.*' + ImageHandler.PATH, ImageHandler),
  1275     ('.*' + ImageHandler.PATH, ImageHandler),
  1241     ('.*' + QueuesPageHandler.PATH, QueuesPageHandler),
  1276     ('.*' + QueuesPageHandler.PATH, QueuesPageHandler),
  1242     ('.*' + TasksPageHandler.PATH, TasksPageHandler),
  1277     ('.*' + TasksPageHandler.PATH, TasksPageHandler),
       
  1278     ('.*' + XMPPPageHandler.PATH, XMPPPageHandler),
       
  1279     ('.*' + InboundMailPageHandler.PATH, InboundMailPageHandler),
  1243     ('.*', DefaultPageHandler),
  1280     ('.*', DefaultPageHandler),
  1244   ]
  1281   ]
  1245   if HAVE_CRON:
  1282   if HAVE_CRON:
  1246     handlers.insert(0, ('.*' + CronPageHandler.PATH, CronPageHandler))
  1283     handlers.insert(0, ('.*' + CronPageHandler.PATH, CronPageHandler))
  1247   application = webapp.WSGIApplication(handlers, debug=_DEBUG)
  1284   application = webapp.WSGIApplication(handlers, debug=_DEBUG)