Merge "Store the context in the local.store."

This commit is contained in:
Jenkins 2013-03-06 17:15:55 +00:00 committed by Gerrit Code Review
commit dc0a82131d

View File

@ -23,6 +23,7 @@ context or provide additional information in their specific WSGI pipeline.
""" """
from reddwarf.openstack.common import context from reddwarf.openstack.common import context
from reddwarf.openstack.common import local
from reddwarf.common import utils from reddwarf.common import utils
@ -42,6 +43,9 @@ class ReddwarfContext(context.RequestContext):
del kwargs['marker'] del kwargs['marker']
super(ReddwarfContext, self).__init__(**kwargs) super(ReddwarfContext, self).__init__(**kwargs)
if not hasattr(local.store, 'context'):
self.update_store()
def to_dict(self): def to_dict(self):
parent_dict = super(ReddwarfContext, self).to_dict() parent_dict = super(ReddwarfContext, self).to_dict()
parent_dict.update({'limit': self.limit, parent_dict.update({'limit': self.limit,
@ -49,6 +53,9 @@ class ReddwarfContext(context.RequestContext):
}) })
return parent_dict return parent_dict
def update_store(self):
local.store.context = self
@classmethod @classmethod
def from_dict(cls, values): def from_dict(cls, values):
return cls(**values) return cls(**values)