add string representation for context

in the cases where context manages to make it's way into a log message
we have no sane representation of it. The to_dict method provides the
relevant information, so we can use a dump of that as our human
friendly version.

Change-Id: I394260c6957ba5c4f2b134e75cf8e7bd1d1b59c2
This commit is contained in:
Sean Dague 2015-03-02 11:16:18 -05:00
parent a07bf6dc8f
commit 239dc9ff7f
1 changed files with 3 additions and 0 deletions

View File

@ -188,6 +188,9 @@ class RequestContext(context.RequestContext):
return context
def __str__(self):
return "<Context %s>" % self.to_dict()
def get_admin_context(read_deleted="no"):
return RequestContext(user_id=None,