don't use get_publisher() in thread (#8856)

This commit is contained in:
Frédéric Péters 2015-11-04 09:48:32 +01:00
parent cc107ee14c
commit c27f35dcdd
1 changed files with 6 additions and 4 deletions

View File

@ -12,7 +12,10 @@ class RemoteTemplate(object):
def get_template_content(self):
import time, os, threading
from quixote import get_response, get_publisher
CACHE_REFRESH_TIMEOUT = 300
self.response = get_response()
self.static_path = get_publisher().get_application_static_files_root_url()
try:
cache_filepath_mtime = os.stat(self.cache_filepath).st_mtime
except OSError: # missing file
@ -31,7 +34,7 @@ class RemoteTemplate(object):
body = """
[if-any bigdiv]<div id="[bigdiv]" [if-any breadcrumb]class="has-breadcrumb"[end]>[end]
<!-- [breadcrumb] -->
[if-any title]<h2>[title]</h2>[end]
[body]
[if-any bigdiv]</div>[end]
@ -71,12 +74,11 @@ class RemoteTemplate(object):
custom_breadcrumb = ''
from quixote import get_response, get_publisher
from quixote.html import htmlescape
response = get_response()
response = self.response
if hasattr(response, 'breadcrumb') and response.breadcrumb:
s = []
path = get_publisher().get_application_static_files_root_url()
path = self.static_path
for i, (component, label) in enumerate(response.breadcrumb[1:]):
if component.startswith('http:') or component.startswith('https:'):
s.append('<li><a href="%s">%s</a></li>' % (component, label))