coleifer/djangosnippets.org — Issue #15: View Snippets Error [snippet_detail.html]
Author: matteius
Created: 2011-12-31 07:26:42+00:00
State: open

Hi, I have spent some time now configuring Django-cab to work with a new website I am developing. So far I have gotten the site mostly functional, with auth logins, and I have used the admin to create a snippet. However I have an issue with viewing the Hello World snippet.

TemplateSyntaxError at /snippets/1/
Caught UnboundLocalError while rendering: local variable 'searcher' referenced before assignment

n template /home/matteius/shared_projects/api_website/api_website/cab/templates/cab/snippet_detail.html, error at line 17
Caught UnboundLocalError while rendering: local variable 'searcher' referenced before assignment7	{% block title %}{{ object.title }}{% endblock %}
8
9	{% block content_header %}{{ object.title }}{% endblock %}
10
11	{% block content %}
12	{{ object.highlighted_code|safe }}
13

14

More like this

15	{% cache 600 mlt object.pk %}
16

17	{% for related in object|more_like_this:5 %}
18
{{ related.object.title }} by {{ related.object.author.username }}
19	{{ related.object.pub_date|timesince }} ago
20

21	{% endfor %}
22

23	{% endcache %}
24

25	{% endblock %}
26
27	{% block sidebar %}

/home/matteius/.virtualenvs/api_website/src/haystack/haystack/backends/whoosh_backend.py in more_like_this
searcher.close()

I did have another issue too when I removed the offending code in the template, however just now I checked and it was resolved, possibly due to specifying a different version of the django tagit depedency, or perhaps it was missing all together. Well this is my current issue has to do with haystack search, and if I remove the offending code the snippet doesn't show up at all?!?