Ejemplo n.º 1
0
 def to_dict(self):
     values = super(RequestContext, self).to_dict()
     # FIXME: defensive hasattr() checks need to be
     # removed once we figure out why we are seeing stack
     # traces
     values.update({
         'user_id':
         getattr(self, 'user_id', None),
         'project_id':
         getattr(self, 'project_id', None),
         'is_admin':
         getattr(self, 'is_admin', None),
         'read_deleted':
         getattr(self, 'read_deleted', 'no'),
         'remote_address':
         getattr(self, 'remote_address', None),
         'timestamp':
         utils.strtime(self.timestamp)
         if hasattr(self, 'timestamp') else None,
         'request_id':
         getattr(self, 'request_id', None),
         'user_name':
         getattr(self, 'user_name', None),
         'service_catalog':
         getattr(self, 'service_catalog', None),
         'project_name':
         getattr(self, 'project_name', None)
     })
     return values
Ejemplo n.º 2
0
 def to_dict(self):
     values = super(RequestContext, self).to_dict()
     # FIXME: defensive hasattr() checks need to be
     # removed once we figure out why we are seeing stack
     # traces
     values.update({
         'user_id': getattr(self, 'user_id', None),
         'project_id': getattr(self, 'project_id', None),
         'is_admin': getattr(self, 'is_admin', None),
         'read_deleted': getattr(self, 'read_deleted', 'no'),
         'remote_address': getattr(self, 'remote_address', None),
         'timestamp': utils.strtime(self.timestamp) if hasattr(
             self, 'timestamp') else None,
         'request_id': getattr(self, 'request_id', None),
         'user_name': getattr(self, 'user_name', None),
         'service_catalog': getattr(self, 'service_catalog', None),
         'project_name': getattr(self, 'project_name', None)
     })
     return values