﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23032	Error with add_to_builtins	anonymous	nobody	"I use Django with Tornado Web Server. It work like a charm when i start my server direcly with Python.

I converted my project into a standalone exe program with py2exe. Now when i load a webpage i get the following error

{{{
ERROR:tornado.application:Uncaught exception, closing connection.
Traceback (most recent call last):
  File ""tornado\iostream.pyc"", line 354, in wrapper
  File ""tornado\stack_context.pyc"", line 331, in wrapped
  File ""tornado\stack_context.pyc"", line 302, in wrapped
  File ""tornado\httpserver.pyc"", line 328, in _on_headers
  File ""tornado\wsgi.pyc"", line 251, in __call__
  File ""django\core\handlers\wsgi.pyc"", line 206, in __call__
  File ""django\core\handlers\base.pyc"", line 196, in get_response
  File ""django\core\handlers\base.pyc"", line 231, in handle_uncaught_exception
  File ""django\views\debug.pyc"", line 69, in technical_500_response
  File ""django\views\debug.pyc"", line 322, in get_traceback_html
  File ""django\template\base.pyc"", line 125, in __init__
  File ""django\template\base.pyc"", line 152, in compile_string
  File ""django\template\debug.pyc"", line 35, in __init__
  File ""django\template\base.pyc"", line 239, in __init__
  File ""django\template\base.pyc"", line 353, in add_library
AttributeError: 'NoneType' object has no attribute 'tags'
ERROR:tornado.application:Exception in callback <functools.partial object at 0x0
3658DB0>
Traceback (most recent call last):
  File ""tornado\ioloop.pyc"", line 477, in _run_callback
  File ""tornado\stack_context.pyc"", line 331, in wrapped
  File ""tornado\stack_context.pyc"", line 302, in wrapped
  File ""tornado\iostream.pyc"", line 354, in wrapper
  File ""tornado\stack_context.pyc"", line 331, in wrapped
  File ""tornado\stack_context.pyc"", line 302, in wrapped
  File ""tornado\httpserver.pyc"", line 328, in _on_headers
  File ""tornado\wsgi.pyc"", line 251, in __call__
  File ""django\core\handlers\wsgi.pyc"", line 206, in __call__
  File ""django\core\handlers\base.pyc"", line 196, in get_response
  File ""django\core\handlers\base.pyc"", line 231, in handle_uncaught_exception
  File ""django\views\debug.pyc"", line 69, in technical_500_response
  File ""django\views\debug.pyc"", line 322, in get_traceback_html
  File ""django\template\base.pyc"", line 125, in __init__
  File ""django\template\base.pyc"", line 152, in compile_string
  File ""django\template\debug.pyc"", line 35, in __init__
  File ""django\template\base.pyc"", line 239, in __init__
  File ""django\template\base.pyc"", line 353, in add_library
AttributeError: 'NoneType' object has no attribute 'tags'
}}}

To fix that problem I add a condition in `add_to_builtins`. This add_to_builtins: https://github.com/django/django/blob/master/django/template/base.py#L1353

My `add_to_builtins` :
{{{
def add_to_builtins(module):
    mod_imported = import_library(module)
    if mod_imported != None :
        builtins.append(mod_imported)
}}}

Don't know if I fix that problem by the right way but that work for me.
"	Bug	closed	Uncategorized	dev	Normal	needsinfo			Unreviewed	1	0	0	0	0	0
