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

Side by Side Diff: chrome/common/extensions/docs/server2/datastore_models.py

Issue 14218004: Devserver: only populate data during cron jobs, meaning all data from instances (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: PTAL 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 # Copyright 2013 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 appengine_wrappers import db
6 import cPickle
7
8 # A collection of the data store models used throughout the server.
9 # These values are global within datastore.
10
11 class PersistentObjectStoreItem(db.Model):
12 pickled_value = db.BlobProperty()
13
14 @classmethod
15 def CreateKey(cls, namespace, key):
16 return db.Key.from_path(cls.__name__, '%s/%s' % (namespace, key))
17
18 @classmethod
19 def CreateItem(cls, namespace, key, value):
20 return PersistentObjectStoreItem(key=cls.CreateKey(namespace, key),
21 pickled_value=cPickle.dumps(value))
22
23 def GetValue(self):
24 return cPickle.loads(self.pickled_value)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698