Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(309)

Unified Diff: chrome/common/extensions/docs/server2/memcache_file_system.py

Issue 10878056: Extensions Docs Server: Fix samples page and ExampleZipper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/memcache_file_system.py
diff --git a/chrome/common/extensions/docs/server2/memcache_file_system.py b/chrome/common/extensions/docs/server2/memcache_file_system.py
index 186e09d004d5bc83629089528ed03ea5f4d46453..6ac119c2889cd15018919d25ed19b50612395bf7 100644
--- a/chrome/common/extensions/docs/server2/memcache_file_system.py
+++ b/chrome/common/extensions/docs/server2/memcache_file_system.py
@@ -7,11 +7,17 @@ from future import Future
import object_store
class _AsyncUncachedFuture(object):
- def __init__(self, uncached, current_result, file_system, object_store):
+ def __init__(self,
+ uncached,
+ current_result,
+ file_system,
+ object_store,
+ namespace):
self._uncached = uncached
self._current_result = current_result
self._file_system = file_system
self._object_store = object_store
+ self._namespace = namespace
def Get(self):
mapping = {}
@@ -20,7 +26,7 @@ class _AsyncUncachedFuture(object):
version = self._file_system.Stat(item).version
mapping[item] = (new_items[item], version)
self._current_result[item] = new_items[item]
- self._object_store.SetMulti(mapping, object_store.FILE_SYSTEM_READ, time=0)
+ self._object_store.SetMulti(mapping, self._namespace, time=0)
return self._current_result
class MemcacheFileSystem(FileSystem):
@@ -67,9 +73,10 @@ class MemcacheFileSystem(FileSystem):
"""
result = {}
uncached = []
- results = self._object_store.GetMulti(paths,
- object_store.FILE_SYSTEM_READ,
- time=0).Get()
+ namespace = object_store.FILE_SYSTEM_READ
+ if binary:
+ namespace = '%s.binary' % namespace
not at google - send to devlin 2012/08/27 04:31:48 is this actually a problem? do we ever read the sa
cduvall 2012/08/27 18:04:34 Yeah we do, this is why I was getting an error whe
not at google - send to devlin 2012/08/28 01:39:09 Ok. I would prefer to see a solution which just ca
+ results = self._object_store.GetMulti(paths, namespace, time=0).Get()
result_values = [x[1] for x in sorted(results.iteritems())]
stats = self._object_store.GetMulti(paths,
object_store.FILE_SYSTEM_STAT).Get()
@@ -85,7 +92,7 @@ class MemcacheFileSystem(FileSystem):
if stat is None:
stat = self.Stat(path).version
if stat != version:
- self._object_store.Delete(path, object_store.FILE_SYSTEM_READ)
+ self._object_store.Delete(path, namespace)
not at google - send to devlin 2012/08/27 04:31:48 Is it necessary to delete this? It will be overrid
cduvall 2012/08/27 18:04:34 Done.
uncached.append(path)
continue
result[path] = data
@@ -96,4 +103,5 @@ class MemcacheFileSystem(FileSystem):
self._file_system.Read(uncached, binary=binary),
result,
self,
- self._object_store))
+ self._object_store,
+ namespace))
« no previous file with comments | « chrome/common/extensions/docs/server2/handler.py ('k') | chrome/common/extensions/docs/server2/samples_data_source.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698