thirdparty/google_appengine/google/appengine/tools/dev_appserver.py
changeset 3031 7678f72140e6
parent 2864 2e0b0af889be
equal deleted inserted replaced
3030:09cae668b536 3031:7678f72140e6
  1200     if HardenedModulesHook.ENABLE_LOGGING:
  1200     if HardenedModulesHook.ENABLE_LOGGING:
  1201       indent = self._indent_level * '  '
  1201       indent = self._indent_level * '  '
  1202       print >>sys.stderr, indent + (message % args)
  1202       print >>sys.stderr, indent + (message % args)
  1203 
  1203 
  1204   _WHITE_LIST_C_MODULES = [
  1204   _WHITE_LIST_C_MODULES = [
       
  1205       'py_streamhtmlparser',
  1205       'AES',
  1206       'AES',
  1206       'ARC2',
  1207       'ARC2',
  1207       'ARC4',
  1208       'ARC4',
  1208       'Blowfish',
  1209       'Blowfish',
  1209       'CAST',
  1210       'CAST',
  2788   def ResetModules(self):
  2789   def ResetModules(self):
  2789     """Clear modules so that when request is run they are reloaded."""
  2790     """Clear modules so that when request is run they are reloaded."""
  2790     self._modules.clear()
  2791     self._modules.clear()
  2791     self._modules.update(self._default_modules)
  2792     self._modules.update(self._default_modules)
  2792     sys.path_hooks[:] = self._save_path_hooks
  2793     sys.path_hooks[:] = self._save_path_hooks
       
  2794     apiproxy_stub_map.apiproxy.GetPreCallHooks().Clear()
       
  2795     apiproxy_stub_map.apiproxy.GetPostCallHooks().Clear()
       
  2796 
  2793 
  2797 
  2794 
  2798 
  2795 
  2799 
  2796 def _ClearTemplateCache(module_dict=sys.modules):
  2800 def _ClearTemplateCache(module_dict=sys.modules):
  2797   """Clear template cache in webapp.template module.
  2801   """Clear template cache in webapp.template module.
  3268   Keywords:
  3272   Keywords:
  3269     root_path: Root path to the directory of the application which should
  3273     root_path: Root path to the directory of the application which should
  3270         contain the app.yaml, indexes.yaml, and queues.yaml files.
  3274         contain the app.yaml, indexes.yaml, and queues.yaml files.
  3271     login_url: Relative URL which should be used for handling user login/logout.
  3275     login_url: Relative URL which should be used for handling user login/logout.
  3272     datastore_path: Path to the file to store Datastore file stub data in.
  3276     datastore_path: Path to the file to store Datastore file stub data in.
  3273     history_path: Path to the file to store Datastore history in.
  3277     history_path: DEPRECATED, No-op.
  3274     clear_datastore: If the datastore and history should be cleared on startup.
  3278     clear_datastore: If the datastore should be cleared on startup.
  3275     smtp_host: SMTP host used for sending test mail.
  3279     smtp_host: SMTP host used for sending test mail.
  3276     smtp_port: SMTP port.
  3280     smtp_port: SMTP port.
  3277     smtp_user: SMTP user.
  3281     smtp_user: SMTP user.
  3278     smtp_password: SMTP password.
  3282     smtp_password: SMTP password.
  3279     enable_sendmail: Whether to use sendmail as an alternative to SMTP.
  3283     enable_sendmail: Whether to use sendmail as an alternative to SMTP.
  3284       except for advanced uses of dev_appserver.
  3288       except for advanced uses of dev_appserver.
  3285   """
  3289   """
  3286   root_path = config.get('root_path', None)
  3290   root_path = config.get('root_path', None)
  3287   login_url = config['login_url']
  3291   login_url = config['login_url']
  3288   datastore_path = config['datastore_path']
  3292   datastore_path = config['datastore_path']
  3289   history_path = config['history_path']
       
  3290   clear_datastore = config['clear_datastore']
  3293   clear_datastore = config['clear_datastore']
  3291   require_indexes = config.get('require_indexes', False)
  3294   require_indexes = config.get('require_indexes', False)
  3292   smtp_host = config.get('smtp_host', None)
  3295   smtp_host = config.get('smtp_host', None)
  3293   smtp_port = config.get('smtp_port', 25)
  3296   smtp_port = config.get('smtp_port', 25)
  3294   smtp_user = config.get('smtp_user', '')
  3297   smtp_user = config.get('smtp_user', '')
  3299   trusted = config.get('trusted', False)
  3302   trusted = config.get('trusted', False)
  3300 
  3303 
  3301   os.environ['APPLICATION_ID'] = app_id
  3304   os.environ['APPLICATION_ID'] = app_id
  3302 
  3305 
  3303   if clear_datastore:
  3306   if clear_datastore:
  3304     for path in (datastore_path, history_path):
  3307     path = datastore_path
  3305       if os.path.lexists(path):
  3308     if os.path.lexists(path):
  3306         logging.info('Attempting to remove file at %s', path)
  3309       logging.info('Attempting to remove file at %s', path)
  3307         try:
  3310       try:
  3308           remove(path)
  3311         remove(path)
  3309         except OSError, e:
  3312       except OSError, e:
  3310           logging.warning('Removing file failed: %s', e)
  3313         logging.warning('Removing file failed: %s', e)
  3311 
  3314 
  3312   apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
  3315   apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()
  3313 
  3316 
  3314   datastore = datastore_file_stub.DatastoreFileStub(
  3317   datastore = datastore_file_stub.DatastoreFileStub(
  3315       app_id, datastore_path, history_path, require_indexes=require_indexes,
  3318       app_id, datastore_path, require_indexes=require_indexes,
  3316       trusted=trusted)
  3319       trusted=trusted)
  3317   apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore)
  3320   apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore)
  3318 
  3321 
  3319   fixed_login_url = '%s?%s=%%s' % (login_url,
  3322   fixed_login_url = '%s?%s=%%s' % (login_url,
  3320                                    dev_appserver_login.CONTINUE_PARAM)
  3323                                    dev_appserver_login.CONTINUE_PARAM)