thirdparty/google_appengine/google/appengine/tools/appcfg.py
changeset 3031 7678f72140e6
parent 2864 2e0b0af889be
equal deleted inserted replaced
3030:09cae668b536 3031:7678f72140e6
  1691                       dest='verbose', help='Print all logs.')
  1691                       dest='verbose', help='Print all logs.')
  1692     parser.add_option('-s', '--server', action='store', dest='server',
  1692     parser.add_option('-s', '--server', action='store', dest='server',
  1693                       default='appengine.google.com',
  1693                       default='appengine.google.com',
  1694                       metavar='SERVER', help='The server to connect to.')
  1694                       metavar='SERVER', help='The server to connect to.')
  1695     parser.add_option('--secure', action='store_true', dest='secure',
  1695     parser.add_option('--secure', action='store_true', dest='secure',
  1696                       default=False,
  1696                       default=True, help=optparse.SUPPRESS_HELP)
  1697                       help='Use SSL when communicating with the server.')
  1697     parser.add_option('--insecure', action='store_false', dest='secure',
       
  1698                       help='Use HTTP when communicating with the server.')
  1698     parser.add_option('-e', '--email', action='store', dest='email',
  1699     parser.add_option('-e', '--email', action='store', dest='email',
  1699                       metavar='EMAIL', default=None,
  1700                       metavar='EMAIL', default=None,
  1700                       help='The username to use. Will prompt if omitted.')
  1701                       help='The username to use. Will prompt if omitted.')
  1701     parser.add_option('-H', '--host', action='store', dest='host',
  1702     parser.add_option('-H', '--host', action='store', dest='host',
  1702                       metavar='HOST', default=None,
  1703                       metavar='HOST', default=None,
  1705                       dest='save_cookies', default=True,
  1706                       dest='save_cookies', default=True,
  1706                       help='Do not save authentication cookies to local disk.')
  1707                       help='Do not save authentication cookies to local disk.')
  1707     parser.add_option('--passin', action='store_true',
  1708     parser.add_option('--passin', action='store_true',
  1708                       dest='passin', default=False,
  1709                       dest='passin', default=False,
  1709                       help='Read the login password from stdin.')
  1710                       help='Read the login password from stdin.')
       
  1711     parser.add_option('-A', '--application', action='store', dest='app_id',
       
  1712                       help='Override application from app.yaml file.')
       
  1713     parser.add_option('-V', '--version', action='store', dest='version',
       
  1714                       help='Override (major) version from app.yaml file.')
  1710     return parser
  1715     return parser
  1711 
  1716 
  1712   def _MakeSpecificParser(self, action):
  1717   def _MakeSpecificParser(self, action):
  1713     """Creates a new parser with documentation specific to 'action'.
  1718     """Creates a new parser with documentation specific to 'action'.
  1714 
  1719 
  1754         password = self.raw_input_fn(password_prompt)
  1759         password = self.raw_input_fn(password_prompt)
  1755       else:
  1760       else:
  1756         password = self.password_input_fn(password_prompt)
  1761         password = self.password_input_fn(password_prompt)
  1757 
  1762 
  1758       return (email, password)
  1763       return (email, password)
       
  1764 
       
  1765     StatusUpdate('Server: %s.' % self.options.server)
  1759 
  1766 
  1760     if self.options.host and self.options.host == 'localhost':
  1767     if self.options.host and self.options.host == 'localhost':
  1761       email = self.options.email
  1768       email = self.options.email
  1762       if email is None:
  1769       if email is None:
  1763         email = 'test@example.com'
  1770         email = 'test@example.com'
  1766           self.options.server,
  1773           self.options.server,
  1767           lambda: (email, 'password'),
  1774           lambda: (email, 'password'),
  1768           GetUserAgent(),
  1775           GetUserAgent(),
  1769           GetSourceName(),
  1776           GetSourceName(),
  1770           host_override=self.options.host,
  1777           host_override=self.options.host,
  1771           save_cookies=self.options.save_cookies)
  1778           save_cookies=self.options.save_cookies,
       
  1779 
       
  1780           secure=False)
  1772       server.authenticated = True
  1781       server.authenticated = True
  1773       return server
  1782       return server
  1774 
  1783 
  1775     if self.options.passin:
  1784     if self.options.passin:
  1776       auth_tries = 1
  1785       auth_tries = 1
  1822     fh = open(appyaml_filename, 'r')
  1831     fh = open(appyaml_filename, 'r')
  1823     try:
  1832     try:
  1824       appyaml = appinfo.LoadSingleAppInfo(fh)
  1833       appyaml = appinfo.LoadSingleAppInfo(fh)
  1825     finally:
  1834     finally:
  1826       fh.close()
  1835       fh.close()
       
  1836     orig_application = appyaml.application
       
  1837     orig_version = appyaml.version
       
  1838     if self.options.app_id:
       
  1839       appyaml.application = self.options.app_id
       
  1840     if self.options.version:
       
  1841       appyaml.version = self.options.version
       
  1842     msg = 'Application: %s' % appyaml.application
       
  1843     if appyaml.application != orig_application:
       
  1844       msg += ' (was: %s)' % orig_application
       
  1845     msg += '; version: %s' % appyaml.version
       
  1846     if appyaml.version != orig_version:
       
  1847       msg += ' (was: %s)' % orig_version
       
  1848     msg += '.'
       
  1849     StatusUpdate(msg)
  1827     return appyaml
  1850     return appyaml
  1828 
  1851 
  1829   def _ParseYamlFile(self, basepath, basename, parser):
  1852   def _ParseYamlFile(self, basepath, basename, parser):
  1830     """Parses the a yaml file.
  1853     """Parses the a yaml file.
  1831 
  1854