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

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

Issue 14125010: Docserver: Add support for viewing docs with a codereview patch applied (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 8 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/object_store_creator.py
===================================================================
--- chrome/common/extensions/docs/server2/object_store_creator.py (revision 196612)
+++ chrome/common/extensions/docs/server2/object_store_creator.py (working copy)
@@ -13,18 +13,29 @@
namespace for the object stores that are created.
- |start_empty| Whether the caching object store that gets created should
start empty, or start with the content of its delegate object stores.
+ - |issue| Code review issue to preview.
+ - |patchset| Code review patchset to preview.
'''
- def __init__(self, app_version, branch, start_empty=False):
+ def __init__(self,
+ app_version,
+ branch,
+ start_empty=False,
+ issue=None,
+ patchset=None):
not at google - send to devlin 2013/04/26 23:53:53 I reckon we should make this stuff more generic, l
方觉(Fang Jue) 2013/04/27 01:02:48 Done.
self._app_version = app_version
self._branch = branch
self._start_empty = start_empty
+ self._issue = issue
+ self._patchset = patchset
def Create(self, cls, store_type=None):
return ObjectStoreCreator(cls,
self._app_version,
self._branch,
store_type=store_type,
- start_empty=self._start_empty)
+ start_empty=self._start_empty,
+ issue=self._issue,
+ patchset=self._patchset)
class SharedFactory(object):
'''A |Factory| for creating object stores shared across branches.
@@ -49,7 +60,9 @@
app_version,
branch,
store_type=None,
- start_empty=False):
+ start_empty=False,
+ issue=None,
+ patchset=None):
'''Creates stores with a top-level namespace given by the name of |cls|
combined with |branch|. Set an explicit |store_type| if necessary for tests.
@@ -59,9 +72,11 @@
'''
assert isinstance(cls, type)
assert not cls.__name__[0].islower() # guard against non-class types
- self._name = '%s/%s@%s' % (app_version, cls.__name__, branch)
+ self._name = '%s/%s@%s%s' % ( app_version, cls.__name__, branch,
+ '' if issue is None else '.%s.%s' % (issue, patchset))
not at google - send to devlin 2013/04/26 23:53:53 ... (continuing from above) then have if self._mo
方觉(Fang Jue) 2013/04/27 01:02:48 Done.
方觉(Fang Jue) 2013/04/29 12:46:23 In the latest patchset, the namespace will be some
self._store_type = store_type
self._start_empty = start_empty
+ self._issue = issue
def Create(self, category=None):
'''Creates a new object store with the top namespace given in the
@@ -74,6 +89,10 @@
namespace = '%s/%s' % (namespace, category)
if self._store_type is not None:
return self._store_type(namespace)
- return CacheChainObjectStore(
- (MemcacheObjectStore(namespace), PersistentObjectStore(namespace)),
- start_empty=self._start_empty)
+ if self._issue is None:
+ return CacheChainObjectStore(
+ (MemcacheObjectStore(namespace), PersistentObjectStore(namespace)),
+ start_empty=self._start_empty)
+ else:
+ return CacheChainObjectStore((MemcacheObjectStore(namespace),),
+ start_empty=self._start_empty)

Powered by Google App Engine
This is Rietveld 408576698