]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Context class should initialise its own data
authorMatthew Booth <mbooth@redhat.com>
Thu, 25 Jun 2015 09:20:08 +0000 (10:20 +0100)
committerMatthew Booth <mbooth@redhat.com>
Thu, 25 Jun 2015 09:22:14 +0000 (10:22 +0100)
This is a trivial cleanup. A superclass was initialising data which
was only used in a subclass.

Change-Id: I6930fdaef3dcb960f6baaedbd191e22b565f319e

neutron/context.py

index 3debe4ccd90df44619cc19476fb7db1e06037005..1e3b5e8223cabb3b0f58088bef6d462bd23fceb3 100644 (file)
@@ -59,7 +59,6 @@ class ContextBase(oslo_context.RequestContext):
         if not timestamp:
             timestamp = datetime.datetime.utcnow()
         self.timestamp = timestamp
-        self._session = None
         self.roles = roles or []
         self.is_advsvc = self.is_admin or policy.check_is_advsvc(self)
         if self.is_admin is None:
@@ -116,6 +115,10 @@ class ContextBase(oslo_context.RequestContext):
 
 
 class Context(ContextBase):
+    def __init__(self, *args, **kwargs):
+        super(Context, self).__init__(*args, **kwargs)
+        self._session = None
+
     @property
     def session(self):
         if self._session is None: