Traceback (most recent call last): File "/srv/osfkarl/production/38/eggs/karl-3.79-py2.6.egg/karl/utilities/mailin.py", line 225, in handle_message self.bounce_message_throttled(message) File "/srv/osfkarl/production/38/eggs/karl-3.79-py2.6.egg/karl/utilities/mailin.py", line 294, in bounce_message_throttled admin_email=get_setting(self.root, 'admin_email'), File "/srv/osfkarl/production/38/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 69, in render return helper.render(value, None, request=request) File "/srv/osfkarl/production/38/eggs/pyramid-1.2.1-py2.6.egg/pyramid/renderers.py", line 416, in render registry.notify(system_values) File "/srv/osfkarl/production/38/eggs/pyramid-1.2.1-py2.6.egg/pyramid/registry.py", line 61, in notify [ _ for _ in self.subscribers(events, None) ] File "/srv/osfkarl/production/38/eggs/zope.component-3.6.0-py2.6.egg/zope/component/registry.py", line 315, in subscribers return self.adapters.subscribers(objects, provided) File "/srv/osfkarl/production/38/eggs/zope.interface-3.5.1-py2.6-linux-i686.egg/zope/interface/adapter.py", line 535, in subscribers subscription(*objects) File "/srv/osfkarl/production/38/eggs/pyramid_bottlecap-0.2a1-py2.6.egg/bottlecap/config.py", line 24, in add_renderer_globals layout_manager = request.layout_manager AttributeError: 'NoneType' object has no attribute 'layout_manager'
If scripts or other code outside a web request renders a template, request will be None and the bottlecap event subscribers will fail. I added a condition in add_renderer_ globals to just return without initializing the layout manager values if there is no request.