equal
deleted
inserted
replaced
69 LOGIN_ADMIN = 'admin' |
69 LOGIN_ADMIN = 'admin' |
70 |
70 |
71 SECURE_HTTP = 'never' |
71 SECURE_HTTP = 'never' |
72 SECURE_HTTPS = 'always' |
72 SECURE_HTTPS = 'always' |
73 SECURE_HTTP_OR_HTTPS = 'optional' |
73 SECURE_HTTP_OR_HTTPS = 'optional' |
|
74 SECURE_DEFAULT = 'default' |
74 |
75 |
75 REQUIRE_MATCHING_FILE = 'require_matching_file' |
76 REQUIRE_MATCHING_FILE = 'require_matching_file' |
76 |
77 |
77 DEFAULT_SKIP_FILES = (r'^(.*/)?(' |
78 DEFAULT_SKIP_FILES = (r'^(.*/)?(' |
78 r'(app\.yaml)|' |
79 r'(app\.yaml)|' |
186 default=LOGIN_OPTIONAL), |
187 default=LOGIN_OPTIONAL), |
187 |
188 |
188 SECURE: validation.Options(SECURE_HTTP, |
189 SECURE: validation.Options(SECURE_HTTP, |
189 SECURE_HTTPS, |
190 SECURE_HTTPS, |
190 SECURE_HTTP_OR_HTTPS, |
191 SECURE_HTTP_OR_HTTPS, |
191 default=SECURE_HTTP), |
192 SECURE_DEFAULT, |
|
193 default=SECURE_DEFAULT), |
192 |
194 |
193 |
195 |
194 |
196 |
195 HANDLER_STATIC_FILES: validation.Optional(_FILES_REGEX), |
197 HANDLER_STATIC_FILES: validation.Optional(_FILES_REGEX), |
196 UPLOAD: validation.Optional(_FILES_REGEX), |
198 UPLOAD: validation.Optional(_FILES_REGEX), |
340 if len(self.handlers) > MAX_URL_MAPS: |
342 if len(self.handlers) > MAX_URL_MAPS: |
341 raise appinfo_errors.TooManyURLMappings( |
343 raise appinfo_errors.TooManyURLMappings( |
342 'Found more than %d URLMap entries in application configuration' % |
344 'Found more than %d URLMap entries in application configuration' % |
343 MAX_URL_MAPS) |
345 MAX_URL_MAPS) |
344 |
346 |
|
347 def FixSecureDefaults(self): |
|
348 """Force omitted 'secure: ...' handler fields to 'secure: optional'. |
|
349 |
|
350 The effect is that handler.secure is never equal to the (nominal) |
|
351 default. |
|
352 |
|
353 See http://b/issue?id=2073962. |
|
354 """ |
|
355 if self.handlers: |
|
356 for handler in self.handlers: |
|
357 if handler.secure == SECURE_DEFAULT: |
|
358 handler.secure = SECURE_HTTP_OR_HTTPS |
|
359 |
345 |
360 |
346 def LoadSingleAppInfo(app_info): |
361 def LoadSingleAppInfo(app_info): |
347 """Load a single AppInfo object where one and only one is expected. |
362 """Load a single AppInfo object where one and only one is expected. |
348 |
363 |
349 Args: |
364 Args: |
368 app_infos = handler.GetResults() |
383 app_infos = handler.GetResults() |
369 if len(app_infos) < 1: |
384 if len(app_infos) < 1: |
370 raise appinfo_errors.EmptyConfigurationFile() |
385 raise appinfo_errors.EmptyConfigurationFile() |
371 if len(app_infos) > 1: |
386 if len(app_infos) > 1: |
372 raise appinfo_errors.MultipleConfigurationFile() |
387 raise appinfo_errors.MultipleConfigurationFile() |
|
388 app_infos[0].FixSecureDefaults() |
373 return app_infos[0] |
389 return app_infos[0] |
374 |
390 |
375 |
391 |
376 def ParseExpiration(expiration): |
392 def ParseExpiration(expiration): |
377 """Parses an expiration delta string. |
393 """Parses an expiration delta string. |