willhardy / django-seo

Provides a set of tools for managing Search Engine Optimisation (SEO) for Django sites.
BSD 3-Clause "New" or "Revised" License
251 stars 117 forks source link

TemplateSyntaxError when using {% get_metadata %} #14

Closed dzida closed 13 years ago

dzida commented 13 years ago

Hi again,

I have a problem with get_metadata tag, my template's fragment looks like this: {% load seo %} {% get_metadata as seo_data %} {{seo_data.keywords}}

On my dev box it works fine, but on test server it raises an error:

File "/usr/local/lib/python2.6/dist-packages/Django_SEO-1.0beta1-py2.6.egg/rollyourown/seo/templatetags/seo.py", line 31, in render
raise template.TemplateSyntaxError(msg)

TemplateSyntaxError: {% get_metadata %} needs some path information.
Please use RequestContext with the django.core.context_processors.request context processor.
Or provide a path or object explicitly, eg {% get_metadata for path %} or {% get_metadata for object %}

Any ideas what is wrong?

willhardy commented 13 years ago

Are you passing RequestContext to your template?

dzida commented 13 years ago

Yes, I always pass RequestContext (I use following pattern in all my views: return render_to_response('name.html', {...}, context_instance=RequestContext(request)))

willhardy commented 13 years ago

That is odd, and can you confirm that you are using the following context processor:

django.core.context_processors.request

If you are, can you tell me which version of Django you are currently using?

willhardy commented 13 years ago

I've changed the way the path is discovered in the templatetag, try it out on your test server and let me know how it goes.

Cheers,

Will

willhardy commented 13 years ago

Closing this ticket, I believe the last change would have fixed any issues with access to the path. Please reopen if you're still getting an exception.

dzida commented 13 years ago

Yes, now it works fine. Thanks a lot.