Advertisement
bossylobster

Cookie Auth Monkey Patch (NOT NEEDED AFTER 1.7.7)

Mar 29th, 2013
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.72 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement