SHARE
TWEET

Cookie Auth Monkey Patch (NOT NEEDED AFTER 1.7.7)

bossylobster Mar 29th, 2013 245 Never
  1. # NOT NEEDED AFTER APP ENGINE VERSION 1.7.7
  2.  
  3. import json
  4. import logging
  5.  
  6. from google.appengine.ext.endpoints import api_config
  7.  
  8.  
  9. class PatchedApiConfigGenerator(api_config.ApiConfigGenerator):
  10.   def pretty_print_config_to_json(self, services, hostname=None):
  11.     logging.warn('TODO: remove this monkey patch after GAE version 1.7.7')
  12.     # Sorry, the next line is not PEP8 compatible :(
  13.     json_string = super(PatchedApiConfigGenerator, self).pretty_print_config_to_json(
  14.         services, hostname=hostname)
  15.     to_patch = json.loads(json_string)
  16.     to_patch['auth'] = {'allowCookieAuth': True}
  17.     return json.dumps(to_patch, sort_keys=True, indent=2)
  18.  
  19.  
  20. api_config.ApiConfigGenerator = PatchedApiConfigGenerator
RAW Paste Data
Top