OLD | NEW |
---|---|
(Empty) | |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 from in_memory_memcache import InMemoryMemcache | |
6 | |
7 # This will attempt to import the actual Appengine modules, and if it fails, | |
not at google - send to devlin
2012/07/31 06:04:36
nit: (here an below), it's "App Engine" not "Appen
| |
8 # they will be replaced with fake modules. This is useful during testing. | |
9 try: | |
10 import google.appengine.ext.webapp as webapp | |
11 import google.appengine.api.memcache as memcache | |
12 import google.appengine.api.urlfetch as urlfetch | |
13 except ImportError: | |
14 class FakeUrlFetch(object): | |
15 def fetch(self, url): | |
16 raise NotImplementedError() | |
17 | |
18 def create_rpc(self): | |
19 raise NotImplementedError() | |
20 | |
21 def make_fetch_call(self): | |
22 raise NotImplementedError() | |
23 urlfetch = FakeUrlFetch() | |
24 | |
25 # Use an in-memory memcache if Appengine memcache isn't available. | |
26 memcache = InMemoryMemcache() | |
27 | |
28 # A fake webapp.RequestHandler class for Handler to extend. | |
29 class webapp(object): | |
30 class RequestHandler(object): | |
31 def __init__(self, request, response): | |
32 self.request = request | |
33 self.response = response | |
OLD | NEW |