Opened 16 years ago
Last modified 13 years ago
#8774 closed
ImageField errors in admin inline editing — at Initial Version
Reported by: | ramin | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | imagefield admin inline | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When trying to edit a model that has another model inlined in the admin the following error occurs. This doesn't occur when creating a new instance. The error was first sighted from an SVN version on Friday 28.8.2008 and is still present in rev 8814.
Template error
In template /usr/lib/python2.5/site-packages/django/contrib/admin/templates/admin/edit_inline/tabular.html, error at line 24
Caught an exception while rendering: coercing to Unicode: need string or buffer, ImageFieldFile found
14 {% endfor %}
15 {% if inline_admin_formset.formset.can_delete %}<th>{% trans "Delete?" %}</th>{% endif %}
16 </tr></thead>
17
18 {% for inline_admin_form in inline_admin_formset %}
19
20 <tr class="{% cycle row1,row2 %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}">
21
22 <td class="original">
23 {% if inline_admin_form.original or inline_admin_form.show_url %}<p>
24 {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}
25 {% if inline_admin_form.show_url %}<a href="../../../r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">{% trans "View on site" %}</a>{% endif %}
26 </p>{% endif %}
27 {{ inline_admin_form.pk_field.field }}
28 {% spaceless %}
29 {% for fieldset in inline_admin_form %}
30 {% for line in fieldset %}
31 {% for field in line %}
32 {% if field.is_hidden %} {{ field.field }} {% endif %}
33 {% endfor %}
34 {% endfor %}
Traceback Switch to copy-and-paste view
- /usr/lib/python2.5/site-packages/django/core/handlers/base.py in get_response
- # Apply view middleware
- for middleware_method in self._view_middleware:
- response = middleware_method(request, callback, callback_args, callback_kwargs)
- if response:
- return response 84.
- try:
- response = callback(request, *callback_args, callback_kwargs) ...
- except Exception, e:
- # If the view raised an exception, run it through exception
- # middleware, and if the exception middleware returns a
- # response, use that. Otherwise, reraise the exception.
- for middleware_method in self._exception_middleware:
- response = middleware_method(request, e)
- /usr/lib/python2.5/site-packages/django/contrib/admin/sites.py in root
- return self.i18n_javascript(request)
- # urls starting with 'r/' are for the "show in web" links
- elif url.startswith('r/'):
- from django.views.defaults import shortcut
- return shortcut(request, *url.split('/')[1:])
- else:
- if '/' in url:
- return self.model_page(request, *url.split('/', 2)) ...
- else:
- return self.app_index(request, url) 176.
- raise http.Http404('The requested admin page does not exist.') 178.
- def model_page(self, request, app_label, model_name, rest_of_url=None):
- /usr/lib/python2.5/site-packages/django/views/decorators/cache.py in _wrapped_view_func
37.
- def never_cache(view_func):
- """
- Decorator that adds headers to a response so that it will
- never be cached.
- """
- def _wrapped_view_func(request, *args, kwargs):
- response = view_func(request, *args, kwargs) ...
- add_never_cache_headers(response)
- return response
- return wraps(view_func)(_wrapped_view_func)
▶ Local vars
Variable Value
args
(<WSGIRequest GET:<QueryDict: {}>, POST:<QueryDict: {}>, COOKIES:{'loj': '813779e21550f0ec85afab540dcaaead'}, META:{'COLORTERM': 'gnome-terminal', 'CONTENT_LENGTH': , 'CONTENT_TYPE': 'text/plain', 'DBUS_SESSION_BUS_ADDRESS': 'unix:abstract=/tmp/dbus-JScisqaUty,guid=a44545a8bb30caddf309679148bc008f', 'DESKTOP_SESSION': 'default', 'DISPLAY': ':0.0', 'DJANGO_SETTINGS_MODULE': 'lifeofjalo.settings', 'GATEWAY_INTERFACE': 'CGI/1.1', 'GDMSESSION': 'default', 'GDM_LANG': 'en_US.UTF-8', 'GDM_XSERVER_LOCATION': 'local', 'GNOME_DESKTOP_SESSION_ID': 'Default', 'GNOME_KEYRING_PID': '11923', 'GNOME_KEYRING_SOCKET': '/tmp/keyring-aOeKUS/socket', 'GPG_AGENT_INFO': '/tmp/seahorse-ZM5CqE/S.gpg-agent:12030:1', 'GTK_RC_FILES': '/etc/gtk/gtkrc:/home/ramin/.gtkrc-1.2-gnome2', 'HISTCONTROL': 'ignoreboth', 'HOME': '/home/ramin', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.7', 'HTTP_ACCEPT_ENCODING': 'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE': 'en-us,en;q=0.5', 'HTTP_CONNECTION': 'keep-alive', 'HTTP_COOKIE': 'loj=813779e21550f0ec85afab540dcaaead', 'HTTP_HOST': 'localhost:8000', 'HTTP_KEEP_ALIVE': '300', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.1) Gecko/2008072820 Firefox/3.0.1', 'LANG': 'en_US.UTF-8', 'LESSCLOSE': '/usr/bin/lesspipe %s %s', 'LESSOPEN': '| /usr/bin/lesspipe %s', 'LIBGL_DRIVERS_PATH': '/usr/lib/dri', 'LOGNAME': 'ramin', 'LS_COLORS': 'no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:su=37;41:sg=30;43:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.svgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.aac=00;36:*.au=00;36:*.flac=00;36:*.mid=00;36:*.midi=00;36:*.mka=00;36:*.mp3=00;36:*.mpc=00;36:*.ogg=00;36:*.ra=00;36:*.wav=00;36:', 'PATH': '/home/ramin/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games', 'PATH_INFO': u'/admin/blogengine/entry/7792/', 'PWD': '/home/ramin/devel/lifeofjalo', 'PYTHONPATH': ':/home/ramin/devel/python', 'QUERY_STRING': , 'REMOTE_ADDR': '127.0.0.1', 'REMOTE_HOST': , 'REQUEST_METHOD': 'GET', 'RUN_MAIN': 'true', 'SCRIPT_NAME': u, 'SERVER_NAME': 'shaftoe.home.fierymill.net', 'SERVER_PORT': '8000', 'SERVER_PROTOCOL': 'HTTP/1.1', 'SERVER_SOFTWARE': 'WSGIServer/0.1 Python/2.5.2', 'SESSION_MANAGER': 'local/shaftoe:/tmp/.ICE-unix/11924', 'SHELL': '/bin/bash', 'SHLVL': '1', 'SSH_AUTH_SOCK': '/tmp/keyring-aOeKUS/ssh', 'TERM': 'xterm', 'TZ': 'Europe/Helsinki', 'USER': 'ramin', 'USERNAME': 'ramin', 'WINDOWID': '31457663', 'WINDOWPATH': '7:7', 'XAUTHORITY': '/tmp/.gdm5V5MGU', 'XDG_DATA_DIRS': '/usr/local/share/:/usr/share/:/usr/share/gdm/', 'XDG_SESSION_COOKIE': '2da2e590671719852a41670046d7eae7-1220280461.811025-1645281592', '_': '/usr/bin/python', 'wsgi.errors': <open file '<stderr>', mode 'w' at 0xb7d150b0>, 'wsgi.file_wrapper': <class 'django.core.servers.basehttp.FileWrapper'>, 'wsgi.input': <socket._fileobject object at 0x87ac1b4>, 'wsgi.multiprocess': False, 'wsgi.multithread': True, 'wsgi.run_once': False, 'wsgi.url_scheme': 'http', 'wsgi.version': (1, 0)}>, u'blogengine', u'entry', u'7792')
kwargs
{}
request
<django.contrib.admin.sites.AdminSite object at 0x84d58ac>
view_func
<function model_page at 0x84d809c>
- /usr/lib/python2.5/site-packages/django/contrib/admin/sites.py in model_page
- model = models.get_model(app_label, model_name)
- if model is None:
- raise http.Http404("App %r, model %r, not found." % (app_label, model_name))
- try:
- admin_obj = self._registry[model]
- except KeyError:
- raise http.Http404("This model exists but has not been registered with the admin site.")
- return admin_obj(request, rest_of_url) ...
- model_page = never_cache(model_page) 194.
- def password_change(self, request):
- """
- Handles the "change password" task -- both form display and validation.
- """
- /usr/lib/python2.5/site-packages/django/contrib/admin/options.py in call
- elif url == "add":
- return self.add_view(request)
- elif url.endswith('/history'):
- return self.history_view(request, unquote(url[:-8]))
- elif url.endswith('/delete'):
- return self.delete_view(request, unquote(url[:-7]))
- else:
- return self.change_view(request, unquote(url)) ... 197.
- def _media(self):
- from django.conf import settings 200.
- js = ['js/core.js', 'js/admin/RelatedObjectLookups.js']
- if self.prepopulated_fields:
- /usr/lib/python2.5/site-packages/django/db/transaction.py in _commit_on_success
- control in web apps.
- """
- def _commit_on_success(*args, kw):
- try:
- enter_transaction_management()
- managed(True)
- try:
- res = func(*args, kw) ...
- except:
- # All exceptions must be handled here (even string ones).
- if is_dirty():
- rollback()
- raise
- else:
- /usr/lib/python2.5/site-packages/django/contrib/admin/options.py in change_view
- 'media': mark_safe(media),
- 'inline_admin_formsets': inline_admin_formsets,
- 'errors': helpers.AdminErrorList(form, formsets),
- 'root_path': self.admin_site.root_path,
- 'app_label': app_label,
- }
- context.update(extra_context or {})
- return self.render_change_form(request, context, change=True, obj=obj) ...
- change_view = transaction.commit_on_success(change_view) 622.
- def changelist_view(self, request, extra_context=None):
- "The 'change list' admin view for this model."
- from django.contrib.admin.views.main import ChangeList, ERROR_FLAG
- opts = self.model._meta
- /usr/lib/python2.5/site-packages/django/contrib/admin/options.py in render_change_form
- 'save_on_top': self.save_on_top,
- 'root_path': self.admin_site.root_path,
- })
- return render_to_response(self.change_form_template or [
- "admin/%s/%s/change_form.html" % (app_label, opts.object_name.lower()),
- "admin/%s/change_form.html" % app_label,
- "admin/change_form.html"
- ], context, context_instance=template.RequestContext(request)) ... 403.
- def response_add(self, request, obj, post_url_continue='../%s/'):
- """
- Determines the HttpResponse for the add_view stage.
- """
- opts = obj._meta
- /usr/lib/python2.5/site-packages/django/shortcuts/init.py in render_to_response
11.
- def render_to_response(*args, kwargs):
- """
- Returns a HttpResponse whose content is filled with the result of calling
- django.template.loader.render_to_string() with the passed arguments.
- """
- httpresponse_kwargs = {'mimetype': kwargs.pop('mimetype', None)}
- return HttpResponse(loader.render_to_string(*args, kwargs), httpresponse_kwargs) ... 19.
- def _get_queryset(klass):
- """
- Returns a QuerySet from a Model, Manager, or QuerySet. Created to make
- get_object_or_404 and get_list_or_404 more DRY.
- """
▶ Local vars
Variable Value
args
(['admin/blogengine/entry/change_form.html', 'admin/blogengine/change_form.html', 'admin/change_form.html'], {'add': False, 'adminform': <django.contrib.admin.helpers.AdminForm object at 0x873e22c>, 'app_label': 'blogengine', 'change': True, 'content_type_id': 9L, 'errors': [], 'form_url': , 'has_absolute_url': False, 'has_add_permission': True, 'has_change_permission': True, 'has_delete_permission': True, 'has_file_field': True, 'inline_admin_formsets': [<django.contrib.admin.helpers.InlineAdminFormSet object at 0x87f8d0c>], 'is_popup': False, 'media': '<script type="text/javascript" src="/admin/static/js/core.js"></script>\n<script type="text/javascript" src="/admin/static/js/admin/RelatedObjectLookups.js"></script>', 'object_id': u'7792', 'opts': <Options for Entry>, 'ordered_objects': [], 'original': <Entry: 2008-08-09 00:00:00>, 'root_path': u'/admin/', 'save_as': False, 'save_on_top': False, 'title': u'Change entry'})
httpresponse_kwargs
{'mimetype': None}
kwargs
{'context_instance': [{'forloop': {'revcounter0': 1, 'last': False, 'counter': 1, 'parentloop': {'revcounter0': 0, 'last': True, 'counter': 1, 'parentloop': {}, 'revcounter': 1, 'counter0': 0, 'first': True}, 'revcounter': 2, 'counter0': 0, 'first': True}, u'inline_admin_form': <django.contrib.admin.helpers.InlineAdminForm object at 0x88a438c>}, {'forloop': {'revcounter0': 0, 'last': True, 'counter': 1, 'parentloop': {}, 'revcounter': 1, 'counter0': 0, 'first': True}, u'inline_admin_formset': <django.contrib.admin.helpers.InlineAdminFormSet object at 0x87f8d0c>}, {'block': <Block Node: content. Contents: [<Text Node: '<div id="content-main"> '>, <Block Node: object-tools. Contents: [<Text Node: ' '>, <If node>, <Text Node: ' '>]>, <Text Node: ' <form '>, <If node>, <Text Node: 'action="'>, <Variable Node: form_url>, <Text Node: '" method="post" id="'>, <Variable Node: opts.module_name>, <Text Node: '_form">'>, <Block Node: form_top. Contents: []>, <Text Node: ' <div> '>, <If node>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <For Node: for fieldset in adminform, tail_len: 3>, <Text Node: ' '>, <Block Node: after_field_sets. Contents: []>, <Text Node: ' '>, <For Node: for inline_admin_formset in inline_admin_formsets, tail_len: 3>, <Text Node: ' '>, <Block Node: after_related_objects. Contents: []>, <Text Node: ' '>, <django.template.InclusionNode object at 0x8747aec>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <Text Node: ' '>, <django.template.InclusionNode object at 0x87474ec>, <Text Node: ' </div> </form></div> '>]>}, {'has_delete_permission': True, 'has_change_permission': True, 'has_add_permission': True, 'inline_admin_formsets': [<django.contrib.admin.helpers.InlineAdminFormSet object at 0x87f8d0c>], 'is_popup': False, 'change': True, 'content_type_id': 9L, 'save_as': False, 'save_on_top': False, 'errors': [], 'has_file_field': True, 'adminform': <django.contrib.admin.helpers.AdminForm object at 0x873e22c>, 'title': u'Change entry', 'media': '<script type="text/javascript" src="/admin/static/js/core.js"></script>\n<script type="text/javascript" src="/admin/static/js/admin/RelatedObjectLookups.js"></script>', 'root_path': u'/admin/', 'object_id': u'7792', 'add': False, 'opts': <Options for Entry>, 'app_label': 'blogengine', 'form_url': , 'original': <Entry: 2008-08-09 00:00:00>, 'has_absolute_url': False, 'ordered_objects': []}, {'MEDIA_URL': 'http://localhost/tests/lifeofjalo/images/'}, {'LANGUAGES': (('fi', 'Finnish'), ('en', 'English')), 'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': u'en'}, {}, {'perms': <django.core.context_processors.PermWrapper object at 0x87f8d6c>, 'messages': [], 'user': <User: ramin>}, {}]}
- /usr/lib/python2.5/site-packages/django/template/loader.py in render_to_string
- t = select_template(template_name)
- else:
- t = get_template(template_name)
- if context_instance:
- context_instance.update(dictionary)
- else:
- context_instance = Context(dictionary)
- return t.render(context_instance) ... 108.
- def select_template(template_name_list):
- "Given a list of template names, returns the first that can be loaded."
- for template_name in template_name_list:
- try:
- return get_template(template_name)
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- def iter(self):
- for node in self.nodelist:
- for subnode in node:
- yield subnode 173.
- def render(self, context):
- "Display stage -- can be called many times"
- return self.nodelist.render(context) ... 177.
- def compile_string(template_string, origin):
- "Compiles template_string into NodeList ready for rendering"
- if settings.TEMPLATE_DEBUG:
- from debug import DebugLexer, DebugParser
- lexer_class, parser_class = DebugLexer, DebugParser
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- # extend_nodelist().
- contains_nontext = False 763.
- def render(self, context):
- bits = []
- for node in self:
- if isinstance(node, Node):
- bits.append(self.render_node(node, context)) ...
- else:
- bits.append(node)
- return mark_safe(.join([force_unicode(b) for b in bits])) 772.
- def get_nodes_by_type(self, nodetype):
- "Return a list of all nodes of the given type"
- /usr/lib/python2.5/site-packages/django/template/debug.py in render_node
- def compile_function_error(self, token, e):
- if not hasattr(e, 'source'):
- e.source = token.source 67.
- class DebugNodeList(NodeList):
- def render_node(self, node, context):
- try:
- result = node.render(context) ...
- except TemplateSyntaxError, e:
- if not hasattr(e, 'source'):
- e.source = node.source
- raise
- except Exception, e:
- from sys import exc_info
- /usr/lib/python2.5/site-packages/django/template/loader_tags.py in render
- # the first non-text node you can stop looking.
- break
- else:
- # Keep any existing parents and add a new one. Used by BlockNode.
- parent_block.parent = block_node.parent
- parent_block.add_parent(parent_block.nodelist)
- parent_block.nodelist = block_node.nodelist
- return compiled_parent.render(context) ... 98.
- class ConstantIncludeNode(Node):
- def init(self, template_path):
- try:
- t = get_template(template_path)
- self.template = t
▶ Local vars
Variable Value
block_node
<Block Node: after_related_objects. Contents: []>
compiled_parent
<django.template.Template object at 0x87f8c8c>
context
[{'forloop': {'revcounter0': 1, 'last': False, 'counter': 1, 'parentloop': {'revcounter0': 0, 'last': True, 'counter': 1, 'parentloop': {}, 'revcounter': 1, 'counter0': 0, 'first': True}, 'revcounter': 2, 'counter0': 0, 'first': True}, u'inline_admin_form': <django.contrib.admin.helpers.InlineAdminForm object at 0x88a438c>}, {'forloop': {'revcounter0': 0, 'last': True, 'counter': 1, 'parentloop': {}, 'revcounter': 1, 'counter0': 0, 'first': True}, u'inline_admin_formset': <django.contrib.admin.helpers.InlineAdminFormSet object at 0x87f8d0c>}, {'block': <Block Node: content. Contents: [<Text Node: '<div id="content-main"> '>, <Block Node: object-tools. Contents: [<Text Node: ' '>, <If node>, <Text Node: ' '>]>, <Text Node: ' <form '>, <If node>, <Text Node: 'action="'>, <Variable Node: form_url>, <Text Node: '" method="post" id="'>, <Variable Node: opts.module_name>, <Text Node: '_form">'>, <Block Node: form_top. Contents: []>, <Text Node: ' <div> '>, <If node>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <For Node: for fieldset in adminform, tail_len: 3>, <Text Node: ' '>, <Block Node: after_field_sets. Contents: []>, <Text Node: ' '>, <For Node: for inline_admin_formset in inline_admin_formsets, tail_len: 3>, <Text Node: ' '>, <Block Node: after_related_objects. Contents: []>, <Text Node: ' '>, <django.template.InclusionNode object at 0x8747aec>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <Text Node: ' '>, <django.template.InclusionNode object at 0x87474ec>, <Text Node: ' </div> </form></div> '>]>}, {'has_delete_permission': True, 'has_change_permission': True, 'has_add_permission': True, 'inline_admin_formsets': [<django.contrib.admin.helpers.InlineAdminFormSet object at 0x87f8d0c>], 'is_popup': False, 'change': True, 'content_type_id': 9L, 'save_as': False, 'save_on_top': False, 'errors': [], 'has_file_field': True, 'adminform': <django.contrib.admin.helpers.AdminForm object at 0x873e22c>, 'title': u'Change entry', 'media': '<script type="text/javascript" src="/admin/static/js/core.js"></script>\n<script type="text/javascript" src="/admin/static/js/admin/RelatedObjectLookups.js"></script>', 'root_path': u'/admin/', 'object_id': u'7792', 'add': False, 'opts': <Options for Entry>, 'app_label': 'blogengine', 'form_url': , 'original': <Entry: 2008-08-09 00:00:00>, 'has_absolute_url': False, 'ordered_objects': []}, {'MEDIA_URL': 'http://localhost/tests/lifeofjalo/images/'}, {'LANGUAGES': (('fi', 'Finnish'), ('en', 'English')), 'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': u'en'}, {}, {'perms': <django.core.context_processors.PermWrapper object at 0x87f8d6c>, 'messages': [], 'user': <User: ramin>}, {}]
n
<Block Node: nav-global. Contents: []>
node
<ExtendsNode: extends "admin/base.html">
parent_blocks
{u'branding': <Block Node: branding. Contents: [<Text Node: ' <h1 id="site-name">'>, <django.templatetags.i18n.TranslateNode object at 0x87afe0c>, <Text Node: '</h1> '>]>, u'nav-global': <Block Node: nav-global. Contents: []>, u'title': <Block Node: title. Contents: [<Variable Node: title|escape>, <Text Node: ' | '>, <django.templatetags.i18n.TranslateNode object at 0x87aff2c>]>}
self
<ExtendsNode: extends "admin/base_site.html">
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- def iter(self):
- for node in self.nodelist:
- for subnode in node:
- yield subnode 173.
- def render(self, context):
- "Display stage -- can be called many times"
- return self.nodelist.render(context) ... 177.
- def compile_string(template_string, origin):
- "Compiles template_string into NodeList ready for rendering"
- if settings.TEMPLATE_DEBUG:
- from debug import DebugLexer, DebugParser
- lexer_class, parser_class = DebugLexer, DebugParser
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- # extend_nodelist().
- contains_nontext = False 763.
- def render(self, context):
- bits = []
- for node in self:
- if isinstance(node, Node):
- bits.append(self.render_node(node, context)) ...
- else:
- bits.append(node)
- return mark_safe(.join([force_unicode(b) for b in bits])) 772.
- def get_nodes_by_type(self, nodetype):
- "Return a list of all nodes of the given type"
- /usr/lib/python2.5/site-packages/django/template/debug.py in render_node
- def compile_function_error(self, token, e):
- if not hasattr(e, 'source'):
- e.source = token.source 67.
- class DebugNodeList(NodeList):
- def render_node(self, node, context):
- try:
- result = node.render(context) ...
- except TemplateSyntaxError, e:
- if not hasattr(e, 'source'):
- e.source = node.source
- raise
- except Exception, e:
- from sys import exc_info
- /usr/lib/python2.5/site-packages/django/template/loader_tags.py in render
- # the first non-text node you can stop looking.
- break
- else:
- # Keep any existing parents and add a new one. Used by BlockNode.
- parent_block.parent = block_node.parent
- parent_block.add_parent(parent_block.nodelist)
- parent_block.nodelist = block_node.nodelist
- return compiled_parent.render(context) ... 98.
- class ConstantIncludeNode(Node):
- def init(self, template_path):
- try:
- t = get_template(template_path)
- self.template = t
▶ Local vars
Variable Value
block_node
<Block Node: after_related_objects. Contents: []>
compiled_parent
<django.template.Template object at 0x874756c>
context
[{'forloop': {'revcounter0': 1, 'last': False, 'counter': 1, 'parentloop': {'revcounter0': 0, 'last': True, 'counter': 1, 'parentloop': {}, 'revcounter': 1, 'counter0': 0, 'first': True}, 'revcounter': 2, 'counter0': 0, 'first': True}, u'inline_admin_form': <django.contrib.admin.helpers.InlineAdminForm object at 0x88a438c>}, {'forloop': {'revcounter0': 0, 'last': True, 'counter': 1, 'parentloop': {}, 'revcounter': 1, 'counter0': 0, 'first': True}, u'inline_admin_formset': <django.contrib.admin.helpers.InlineAdminFormSet object at 0x87f8d0c>}, {'block': <Block Node: content. Contents: [<Text Node: '<div id="content-main"> '>, <Block Node: object-tools. Contents: [<Text Node: ' '>, <If node>, <Text Node: ' '>]>, <Text Node: ' <form '>, <If node>, <Text Node: 'action="'>, <Variable Node: form_url>, <Text Node: '" method="post" id="'>, <Variable Node: opts.module_name>, <Text Node: '_form">'>, <Block Node: form_top. Contents: []>, <Text Node: ' <div> '>, <If node>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <For Node: for fieldset in adminform, tail_len: 3>, <Text Node: ' '>, <Block Node: after_field_sets. Contents: []>, <Text Node: ' '>, <For Node: for inline_admin_formset in inline_admin_formsets, tail_len: 3>, <Text Node: ' '>, <Block Node: after_related_objects. Contents: []>, <Text Node: ' '>, <django.template.InclusionNode object at 0x8747aec>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <Text Node: ' '>, <django.template.InclusionNode object at 0x87474ec>, <Text Node: ' </div> </form></div> '>]>}, {'has_delete_permission': True, 'has_change_permission': True, 'has_add_permission': True, 'inline_admin_formsets': [<django.contrib.admin.helpers.InlineAdminFormSet object at 0x87f8d0c>], 'is_popup': False, 'change': True, 'content_type_id': 9L, 'save_as': False, 'save_on_top': False, 'errors': [], 'has_file_field': True, 'adminform': <django.contrib.admin.helpers.AdminForm object at 0x873e22c>, 'title': u'Change entry', 'media': '<script type="text/javascript" src="/admin/static/js/core.js"></script>\n<script type="text/javascript" src="/admin/static/js/admin/RelatedObjectLookups.js"></script>', 'root_path': u'/admin/', 'object_id': u'7792', 'add': False, 'opts': <Options for Entry>, 'app_label': 'blogengine', 'form_url': , 'original': <Entry: 2008-08-09 00:00:00>, 'has_absolute_url': False, 'ordered_objects': []}, {'MEDIA_URL': 'http://localhost/tests/lifeofjalo/images/'}, {'LANGUAGES': (('fi', 'Finnish'), ('en', 'English')), 'LANGUAGE_BIDI': False, 'LANGUAGE_CODE': u'en'}, {}, {'perms': <django.core.context_processors.PermWrapper object at 0x87f8d6c>, 'messages': [], 'user': <User: ramin>}, {}]
n
<Block Node: footer. Contents: [<Text Node: '<div id="footer"></div>'>]>
node
<Variable Node: LANGUAGE_CODE>
parent_block
<Block Node: object-tools. Contents: [<Text Node: ' '>, <If node>, <Text Node: ' '>]>
parent_blocks
{u'blockbots': <Block Node: blockbots. Contents: [<Text Node: '<meta name="robots" conte'>]>, u'bodyclass': <Block Node: bodyclass. Contents: [<Variable Node: opts.app_label>, <Text Node: '-'>, <Variable Node: opts.object_name.lower>, <Text Node: ' change-form'>]>, u'branding': <Block Node: branding. Contents: [<Text Node: ' <h1 id="site-name">'>, <django.templatetags.i18n.TranslateNode object at 0x87afe0c>, <Text Node: '</h1> '>]>, u'breadcrumbs': <Block Node: breadcrumbs. Contents: [<If node>]>, u'coltype': <Block Node: coltype. Contents: [<If node>]>, u'content': <Block Node: content. Contents: [<Text Node: '<div id="content-main"> '>, <Block Node: object-tools. Contents: [<Text Node: ' '>, <If node>, <Text Node: ' '>]>, <Text Node: ' <form '>, <If node>, <Text Node: 'action="'>, <Variable Node: form_url>, <Text Node: '" method="post" id="'>, <Variable Node: opts.module_name>, <Text Node: '_form">'>, <Block Node: form_top. Contents: []>, <Text Node: ' <div> '>, <If node>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <For Node: for fieldset in adminform, tail_len: 3>, <Text Node: ' '>, <Block Node: after_field_sets. Contents: []>, <Text Node: ' '>, <For Node: for inline_admin_formset in inline_admin_formsets, tail_len: 3>, <Text Node: ' '>, <Block Node: after_related_objects. Contents: []>, <Text Node: ' '>, <django.template.InclusionNode object at 0x8747aec>, <Text Node: ' '>, <If node>, <Text Node: ' '>, <Text Node: ' '>, <django.template.InclusionNode object at 0x87474ec>, <Text Node: ' </div> </form></div> '>]>, u'content_title': <Block Node: content_title. Contents: [<If node>]>, u'extrahead': <Block Node: extrahead. Contents: [<Variable Node: block.super>, <Text Node: ' <script type="text/javas'>, <Variable Node: media>, <Text Node: ' '>]>, u'extrastyle': <Block Node: extrastyle. Contents: []>, u'footer': <Block Node: footer. Contents: [<Text Node: '<div id="footer"></div>'>]>, u'nav-global': <Block Node: nav-global. Contents: []>, u'object-tools': <Block Node: object-tools. Contents: [<Text Node: ' '>, <If node>, <Text Node: ' '>]>, u'pretitle': <Block Node: pretitle. Contents: []>, u'sidebar': <Block Node: sidebar. Contents: []>, u'stylesheet': <Block Node: stylesheet. Contents: [<django.template.SimpleNode object at 0x879648c>, <Text Node: 'css/forms.css'>]>, u'stylesheet_rtl': <Block Node: stylesheet_rtl. Contents: [<django.template.SimpleNode object at 0x877ec6c>, <Text Node: 'css/rtl.css'>]>, u'title': <Block Node: title. Contents: [<Variable Node: title|escape>, <Text Node: ' | '>, <django.templatetags.i18n.TranslateNode object at 0x87aff2c>]>, u'userlinks': <Block Node: userlinks. Contents: [<django.template.defaulttags.URLNode object at 0x857668c>, <If node>, <Text Node: '<a href="'>, <Variable Node: root_path>, <Text Node: 'password_change/">'>, <django.templatetags.i18n.TranslateNode object at 0x87af58c>, <Text Node: '</a> / <a href="'>, <Variable Node: root_path>, <Text Node: 'logout/">'>, <django.templatetags.i18n.TranslateNode object at 0x877e22c>, <Text Node: '</a>'>]>}
self
<ExtendsNode: extends "admin/base.html">
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- def iter(self):
- for node in self.nodelist:
- for subnode in node:
- yield subnode 173.
- def render(self, context):
- "Display stage -- can be called many times"
- return self.nodelist.render(context) ... 177.
- def compile_string(template_string, origin):
- "Compiles template_string into NodeList ready for rendering"
- if settings.TEMPLATE_DEBUG:
- from debug import DebugLexer, DebugParser
- lexer_class, parser_class = DebugLexer, DebugParser
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- # extend_nodelist().
- contains_nontext = False 763.
- def render(self, context):
- bits = []
- for node in self:
- if isinstance(node, Node):
- bits.append(self.render_node(node, context)) ...
- else:
- bits.append(node)
- return mark_safe(.join([force_unicode(b) for b in bits])) 772.
- def get_nodes_by_type(self, nodetype):
- "Return a list of all nodes of the given type"
- /usr/lib/python2.5/site-packages/django/template/debug.py in render_node
- def compile_function_error(self, token, e):
- if not hasattr(e, 'source'):
- e.source = token.source 67.
- class DebugNodeList(NodeList):
- def render_node(self, node, context):
- try:
- result = node.render(context) ...
- except TemplateSyntaxError, e:
- if not hasattr(e, 'source'):
- e.source = node.source
- raise
- except Exception, e:
- from sys import exc_info
- /usr/lib/python2.5/site-packages/django/template/loader_tags.py in render
- return "<Block Node: %s. Contents: %r>" % (self.name, self.nodelist) 18.
- def render(self, context):
- context.push()
- # Save context in case of block.super().
- self.context = context
- contextblock = self
- result = self.nodelist.render(context) ...
- context.pop()
- return result 27.
- def super(self):
- if self.parent:
- return mark_safe(self.parent.render(self.context))
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- # extend_nodelist().
- contains_nontext = False 763.
- def render(self, context):
- bits = []
- for node in self:
- if isinstance(node, Node):
- bits.append(self.render_node(node, context)) ...
- else:
- bits.append(node)
- return mark_safe(.join([force_unicode(b) for b in bits])) 772.
- def get_nodes_by_type(self, nodetype):
- "Return a list of all nodes of the given type"
- /usr/lib/python2.5/site-packages/django/template/debug.py in render_node
- def compile_function_error(self, token, e):
- if not hasattr(e, 'source'):
- e.source = token.source 67.
- class DebugNodeList(NodeList):
- def render_node(self, node, context):
- try:
- result = node.render(context) ...
- except TemplateSyntaxError, e:
- if not hasattr(e, 'source'):
- e.source = node.source
- raise
- except Exception, e:
- from sys import exc_info
- /usr/lib/python2.5/site-packages/django/template/defaulttags.py in render
- if unpack:
- # If there are multiple loop variables, unpack the item into
- # them.
- context.update(dict(zip(self.loopvars, item)))
- else:
- context[self.loopvars[0]] = item
- for node in self.nodelist_loop:
- nodelist.append(node.render(context)) ...
- if unpack:
- # The loop variables were pushed on to the context so pop them
- # off again. This is necessary because the tag lets the length
- # of loopvars differ to the length of each set of items and we
- # don't want to leave any vars from the previous loop on the
- # context.
- /usr/lib/python2.5/site-packages/django/template/loader_tags.py in render
- def init(self, template_name):
- self.template_name = Variable(template_name) 118.
- def render(self, context):
- try:
- template_name = self.template_name.resolve(context)
- t = get_template(template_name)
- return t.render(context) ...
- except TemplateSyntaxError, e:
- if settings.TEMPLATE_DEBUG:
- raise
- return
- except:
- return # Fail silently for invalid included templates.
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- def iter(self):
- for node in self.nodelist:
- for subnode in node:
- yield subnode 173.
- def render(self, context):
- "Display stage -- can be called many times"
- return self.nodelist.render(context) ... 177.
- def compile_string(template_string, origin):
- "Compiles template_string into NodeList ready for rendering"
- if settings.TEMPLATE_DEBUG:
- from debug import DebugLexer, DebugParser
- lexer_class, parser_class = DebugLexer, DebugParser
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- # extend_nodelist().
- contains_nontext = False 763.
- def render(self, context):
- bits = []
- for node in self:
- if isinstance(node, Node):
- bits.append(self.render_node(node, context)) ...
- else:
- bits.append(node)
- return mark_safe(.join([force_unicode(b) for b in bits])) 772.
- def get_nodes_by_type(self, nodetype):
- "Return a list of all nodes of the given type"
- /usr/lib/python2.5/site-packages/django/template/debug.py in render_node
- def compile_function_error(self, token, e):
- if not hasattr(e, 'source'):
- e.source = token.source 67.
- class DebugNodeList(NodeList):
- def render_node(self, node, context):
- try:
- result = node.render(context) ...
- except TemplateSyntaxError, e:
- if not hasattr(e, 'source'):
- e.source = node.source
- raise
- except Exception, e:
- from sys import exc_info
- /usr/lib/python2.5/site-packages/django/template/defaulttags.py in render
- if unpack:
- # If there are multiple loop variables, unpack the item into
- # them.
- context.update(dict(zip(self.loopvars, item)))
- else:
- context[self.loopvars[0]] = item
- for node in self.nodelist_loop:
- nodelist.append(node.render(context)) ...
- if unpack:
- # The loop variables were pushed on to the context so pop them
- # off again. This is necessary because the tag lets the length
- # of loopvars differ to the length of each set of items and we
- # don't want to leave any vars from the previous loop on the
- # context.
- /usr/lib/python2.5/site-packages/django/template/defaulttags.py in render
- if self.link_type == IfNode.LinkTypes.or_:
- for ifnot, bool_expr in self.bool_exprs:
- try:
- value = bool_expr.resolve(context, True)
- except VariableDoesNotExist:
- value = None
- if (value and not ifnot) or (ifnot and not value):
- return self.nodelist_true.render(context) ...
- return self.nodelist_false.render(context)
- else:
- for ifnot, bool_expr in self.bool_exprs:
- try:
- value = bool_expr.resolve(context, True)
- except VariableDoesNotExist:
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- # extend_nodelist().
- contains_nontext = False 763.
- def render(self, context):
- bits = []
- for node in self:
- if isinstance(node, Node):
- bits.append(self.render_node(node, context)) ...
- else:
- bits.append(node)
- return mark_safe(.join([force_unicode(b) for b in bits])) 772.
- def get_nodes_by_type(self, nodetype):
- "Return a list of all nodes of the given type"
- /usr/lib/python2.5/site-packages/django/template/debug.py in render_node
- def compile_function_error(self, token, e):
- if not hasattr(e, 'source'):
- e.source = token.source 67.
- class DebugNodeList(NodeList):
- def render_node(self, node, context):
- try:
- result = node.render(context) ...
- except TemplateSyntaxError, e:
- if not hasattr(e, 'source'):
- e.source = node.source
- raise
- except Exception, e:
- from sys import exc_info
- /usr/lib/python2.5/site-packages/django/template/defaulttags.py in render
- if self.link_type == IfNode.LinkTypes.or_:
- for ifnot, bool_expr in self.bool_exprs:
- try:
- value = bool_expr.resolve(context, True)
- except VariableDoesNotExist:
- value = None
- if (value and not ifnot) or (ifnot and not value):
- return self.nodelist_true.render(context) ...
- return self.nodelist_false.render(context)
- else:
- for ifnot, bool_expr in self.bool_exprs:
- try:
- value = bool_expr.resolve(context, True)
- except VariableDoesNotExist:
- /usr/lib/python2.5/site-packages/django/template/init.py in render
- # extend_nodelist().
- contains_nontext = False 763.
- def render(self, context):
- bits = []
- for node in self:
- if isinstance(node, Node):
- bits.append(self.render_node(node, context)) ...
- else:
- bits.append(node)
- return mark_safe(.join([force_unicode(b) for b in bits])) 772.
- def get_nodes_by_type(self, nodetype):
- "Return a list of all nodes of the given type"
- /usr/lib/python2.5/site-packages/django/template/debug.py in render_node
- e.source = node.source
- raise
- except Exception, e:
- from sys import exc_info
- wrapped = TemplateSyntaxError(u'Caught an exception while rendering: %s' % force_unicode(e, errors='replace'))
- wrapped.source = node.source
- wrapped.exc_info = exc_info()
- raise wrapped ...
- return result 83.
- class DebugVariableNode(VariableNode):
- def render(self, context):
- try:
- output = force_unicode(self.filter_expression.resolve(context))