Skip to content

Instantly share code, notes, and snippets.

@drcongo
Created December 13, 2018 10:36
Show Gist options
  • Save drcongo/97b7d8a4b32acf572ec22d9e100337d8 to your computer and use it in GitHub Desktop.
Save drcongo/97b7d8a4b32acf572ec22d9e100337d8 to your computer and use it in GitHub Desktop.
> /usr/srv/app/src/wagtail-cache/wagtailcache/cache.py(49)_wrapped_view_func()
48 import ipdb; ipdb.set_trace()
---> 49 response = djcache.process_request(request)
50 if response:
ipdb> n
> /usr/srv/app/src/wagtail-cache/wagtailcache/cache.py(50)_wrapped_view_func()
49 response = djcache.process_request(request)
---> 50 if response:
51 # add a response header to indicate this was a cache hit
ipdb>
> /usr/srv/app/src/wagtail-cache/wagtailcache/cache.py(57)_wrapped_view_func()
56 # since we don't have a response at this point, run the view.
---> 57 response = view_func(request, *args, **kwargs)
58 # add a response header to indicate this was a cache miss
ipdb>
> /usr/srv/app/src/wagtail-cache/wagtailcache/cache.py(59)_wrapped_view_func()
58 # add a response header to indicate this was a cache miss
---> 59 if wagtailcache_settings['WAGTAIL_CACHE_HEADER']:
60 response[wagtailcache_settings['WAGTAIL_CACHE_HEADER']] = 'miss'
ipdb>
> /usr/srv/app/src/wagtail-cache/wagtailcache/cache.py(60)_wrapped_view_func()
59 if wagtailcache_settings['WAGTAIL_CACHE_HEADER']:
---> 60 response[wagtailcache_settings['WAGTAIL_CACHE_HEADER']] = 'miss'
61 djcache.process_response(request, response)
ipdb>
> /usr/srv/app/src/wagtail-cache/wagtailcache/cache.py(61)_wrapped_view_func()
60 response[wagtailcache_settings['WAGTAIL_CACHE_HEADER']] = 'miss'
---> 61 djcache.process_response(request, response)
62
ipdb>
> /usr/srv/app/src/wagtail-cache/wagtailcache/cache.py(63)_wrapped_view_func()
62
---> 63 return response
64
ipdb>
--Return--
<TemplateResp...harset=utf-8">
> /usr/srv/app/src/wagtail-cache/wagtailcache/cache.py(63)_wrapped_view_func()
62
---> 63 return response
64
ipdb>
> /usr/lib/python3.6/site-packages/django/core/handlers/base.py(131)_get_response()
130 # Complain if the view returned None (a common error).
--> 131 if response is None:
132 if isinstance(callback, types.FunctionType): # FBV
ipdb>
> /usr/lib/python3.6/site-packages/django/core/handlers/base.py(144)_get_response()
143 # response middleware and then render the response
--> 144 elif hasattr(response, 'render') and callable(response.render):
145 for middleware_method in self._template_response_middleware:
ipdb>
> /usr/lib/python3.6/site-packages/django/core/handlers/base.py(145)_get_response()
144 elif hasattr(response, 'render') and callable(response.render):
--> 145 for middleware_method in self._template_response_middleware:
146 response = middleware_method(request, response)
ipdb>
> /usr/lib/python3.6/site-packages/django/core/handlers/base.py(146)_get_response()
145 for middleware_method in self._template_response_middleware:
--> 146 response = middleware_method(request, response)
147 # Complain if the template response middleware returned None (a common error).
ipdb>
> /usr/lib/python3.6/site-packages/django/core/handlers/base.py(148)_get_response()
147 # Complain if the template response middleware returned None (a common error).
--> 148 if response is None:
149 raise ValueError(
ipdb>
> /usr/lib/python3.6/site-packages/django/core/handlers/base.py(145)_get_response()
144 elif hasattr(response, 'render') and callable(response.render):
--> 145 for middleware_method in self._template_response_middleware:
146 response = middleware_method(request, response)
ipdb>
> /usr/lib/python3.6/site-packages/django/core/handlers/base.py(155)_get_response()
154
--> 155 try:
156 response = response.render()
ipdb>
> /usr/lib/python3.6/site-packages/django/core/handlers/base.py(156)_get_response()
155 try:
--> 156 response = response.render()
157 except Exception as e:
ipdb> s
--Call--
> /usr/lib/python3.6/site-packages/django/template/response.py(97)render()
96
---> 97 def render(self):
98 """Render (thereby finalizing) the content of the response.
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(104)render()
103 """
--> 104 retval = self
105 if not self._is_rendered:
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(105)render()
104 retval = self
--> 105 if not self._is_rendered:
106 self.content = self.rendered_content
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(106)render()
105 if not self._is_rendered:
--> 106 self.content = self.rendered_content
107 for post_callback in self._post_render_callbacks:
ipdb> s
--Call--
> /usr/lib/python3.6/site-packages/django/template/response.py(72)rendered_content()
71
---> 72 @property
73 def rendered_content(self):
ipdb> n
> /usr/lib/python3.6/site-packages/django/template/response.py(81)rendered_content()
80 """
---> 81 template = self.resolve_template(self.template_name)
82 context = self.resolve_context(self.context_data)
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(82)rendered_content()
81 template = self.resolve_template(self.template_name)
---> 82 context = self.resolve_context(self.context_data)
83 content = template.render(context, self._request)
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(83)rendered_content()
82 context = self.resolve_context(self.context_data)
---> 83 content = template.render(context, self._request)
84 return content
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(84)rendered_content()
83 content = template.render(context, self._request)
---> 84 return content
85
ipdb>
--Return--
'\n\n\n\n\n<!...g>\n</html>\n'
> /usr/lib/python3.6/site-packages/django/template/response.py(84)rendered_content()
83 content = template.render(context, self._request)
---> 84 return content
85
ipdb>
--Call--
> /usr/lib/python3.6/site-packages/django/template/response.py(132)content()
131
--> 132 @content.setter
133 def content(self, value):
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(135)content()
134 """Set the content for the response."""
--> 135 HttpResponse.content.fset(self, value)
136 self._is_rendered = True
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(136)content()
135 HttpResponse.content.fset(self, value)
--> 136 self._is_rendered = True
137
ipdb>
--Return--
None
> /usr/lib/python3.6/site-packages/django/template/response.py(136)content()
135 HttpResponse.content.fset(self, value)
--> 136 self._is_rendered = True
137
ipdb>
> /usr/lib/python3.6/site-packages/django/template/response.py(107)render()
106 self.content = self.rendered_content
--> 107 for post_callback in self._post_render_callbacks:
108 newretval = post_callback(retval)
ipdb> retval
<TemplateResponse status_code=200, "text/html; charset=utf-8">
ipdb> s
> /usr/lib/python3.6/site-packages/django/template/response.py(108)render()
107 for post_callback in self._post_render_callbacks:
--> 108 newretval = post_callback(retval)
109 if newretval is not None:
ipdb> s
--Call--
> /usr/lib/python3.6/site-packages/django/middleware/cache.py(102)<lambda>()
101 response.add_post_render_callback(
--> 102 lambda r: self.cache.set(cache_key, r, timeout)
103 )
ipdb> self
<django.middleware.cache.CacheMiddleware object at 0x7faa01c10be0>
ipdb> s
> /usr/lib/python3.6/site-packages/django/middleware/cache.py(102)<lambda>()
101 response.add_post_render_callback(
--> 102 lambda r: self.cache.set(cache_key, r, timeout)
103 )
ipdb> s
--Call--
> /usr/lib/python3.6/site-packages/redis_cache/backends/base.py(28)wrapped()
27
---> 28 @wraps(method)
29 def wrapped(self, key, *args, **kwargs):
ipdb>
> /usr/lib/python3.6/site-packages/redis_cache/backends/base.py(30)wrapped()
29 def wrapped(self, key, *args, **kwargs):
---> 30 version = kwargs.pop('version', None)
31 client = self.get_client(key, write=write)
ipdb>
> /usr/lib/python3.6/site-packages/redis_cache/backends/base.py(31)wrapped()
30 version = kwargs.pop('version', None)
---> 31 client = self.get_client(key, write=write)
32 key = self.make_key(key, version=version)
ipdb>
--Call--
> /usr/lib/python3.6/site-packages/redis_cache/backends/single.py(27)get_client()
26
---> 27 def get_client(self, key, write=False):
28 if write and self.master_client is not None:
ipdb> n
> /usr/lib/python3.6/site-packages/redis_cache/backends/single.py(28)get_client()
27 def get_client(self, key, write=False):
---> 28 if write and self.master_client is not None:
29 return self.master_client
ipdb>
> /usr/lib/python3.6/site-packages/redis_cache/backends/single.py(29)get_client()
28 if write and self.master_client is not None:
---> 29 return self.master_client
30 return random.choice(list(self.client_list))
ipdb>
--Return--
Redis<Blockin...t=6379,db=1>>>
> /usr/lib/python3.6/site-packages/redis_cache/backends/single.py(29)get_client()
28 if write and self.master_client is not None:
---> 29 return self.master_client
30 return random.choice(list(self.client_list))
ipdb>
> /usr/lib/python3.6/site-packages/redis_cache/backends/base.py(32)wrapped()
31 client = self.get_client(key, write=write)
---> 32 key = self.make_key(key, version=version)
33 return method(self, client, key, *args, **kwargs)
ipdb>
> /usr/lib/python3.6/site-packages/redis_cache/backends/base.py(33)wrapped()
32 key = self.make_key(key, version=version)
---> 33 return method(self, client, key, *args, **kwargs)
34
ipdb> method
<function BaseRedisCache.set at 0x7faa0a424378>
ipdb> n
--Return--
True
> /usr/lib/python3.6/site-packages/redis_cache/backends/base.py(33)wrapped()
32 key = self.make_key(key, version=version)
---> 33 return method(self, client, key, *args, **kwargs)
34
ipdb>
--Return--
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment