Yes, satchmo_category_kevin.py is in /shop_customizations/ templatetags, and there is a __init__.py in both /shop_customizations and /shop_customizations/templatetags. I'm pretty sure that this app is properly installed, as it breaks when I change the name of the registered tag. However, I may have skipped a step in building the app?
Here's the traceback for when I change register.simple_tag (category_tree) to register.simple_tag(category_tree_kevin): ----------------------------------------------------------------------------------- Environment: Request Method: GET Request URL: http://localhost:8000/ Django Version: 1.0.2 final Python Version: 2.4.5 Installed Applications: ['django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'seemoredotcom.content', 'seemoredotcom.shop_customizations', 'satchmo_store.shop', 'django.contrib.contenttypes', 'django.contrib.comments', 'django.contrib.sessions', 'django.contrib.sitemaps', 'registration', 'keyedcache', 'livesettings', 'l10n', 'sorl.thumbnail', 'satchmo_store.contact', 'tax', 'tax.modules.no', 'tax.modules.area', 'tax.modules.percent', 'shipping', 'product', 'payment', 'payment.modules.giftcertificate', 'satchmo_utils', 'app_plugins'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.middleware.doc.XViewMiddleware', 'threaded_multihost.middleware.ThreadLocalMiddleware', 'satchmo_store.shop.SSLMiddleware.SSLRedirect') Template error: In template /usr/lib/python2.4/site-packages/Satchmo-0.9_pre-py2.4.egg/ satchmo_store/shop/templates/shop/base.html, error at line 1 Caught an exception while rendering: name 'category_tree_kevin' is not defined 1 : {% extends "base.html" %} 2 : {# override this template if you want your shop template to be different than your base template #} Traceback: File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in get_response 86. response = callback(request, *callback_args, **callback_kwargs) File "/usr/lib/python2.4/site-packages/Satchmo-0.9_pre-py2.4.egg/ satchmo_store/shop/views/home.py" in home 40. return render_to_response(template, ctx) File "/usr/lib/python2.4/site-packages/django/shortcuts/__init__.py" in render_to_response 18. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs) File "/usr/lib/python2.4/site-packages/django/template/loader.py" in render_to_string 107. return t.render(context_instance) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in render 176. return self.nodelist.render(context) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in render 768. bits.append(self.render_node(node, context)) File "/usr/lib/python2.4/site-packages/django/template/debug.py" in render_node 71. result = node.render(context) File "/usr/lib/python2.4/site-packages/django/template/loader_tags.py" in render 97. return compiled_parent.render(context) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in render 176. return self.nodelist.render(context) File "/usr/lib/python2.4/site-packages/django/template/__init__.py" in render 768. bits.append(self.render_node(node, context)) File "/usr/lib/python2.4/site-packages/django/template/debug.py" in render_node 81. raise wrapped Exception Type: TemplateSyntaxError at / Exception Value: Caught an exception while rendering: name 'category_tree_kevin' is not defined Original Traceback (most recent call last): File "/usr/lib/python2.4/site-packages/django/template/debug.py", line 71, in render_node result = node.render(context) File "/usr/lib/python2.4/site-packages/django/template/ loader_tags.py", line 71, in render compiled_parent = self.get_parent(context) File "/usr/lib/python2.4/site-packages/django/template/ loader_tags.py", line 68, in get_parent return get_template_from_string(source, origin, parent) File "/usr/lib/python2.4/site-packages/django/template/loader.py", line 89, in get_template_from_string return Template(source, origin, name) File "/usr/lib/python2.4/site-packages/django/template/__init__.py", line 166, in __init__ self.nodelist = compile_string(template_string, origin) File "/usr/lib/python2.4/site-packages/django/template/__init__.py", line 187, in compile_string return parser.parse() File "/usr/lib/python2.4/site-packages/django/template/__init__.py", line 283, in parse compiled_result = compile_func(self, token) File "/usr/lib/python2.4/site-packages/django/template/ defaulttags.py", line 876, in load lib = get_library("django.templatetags.%s" % taglib) File "/usr/lib/python2.4/site-packages/django/template/__init__.py", line 937, in get_library mod = __import__(module_name, {}, {}, ['']) File "/home/harveyk/workspace/seemoredotcom/../seemoredotcom/ shop_customizations/templatetags/satchmo_category_kevin.py", line 59, in ? register.simple_tag(category_tree_kevin) NameError: name 'category_tree_kevin' is not defined ----------------------------------------------------------------------------------------------------------------- Thanks for your help. On Jul 15, 11:48 am, Bob Waycott <[email protected]> wrote: > Can you provide a Traceback of how it "breaks the site?" > Also, did you place satchmo_category_kevin.py into a templatetags/ dir > inside your app? Is there an __init__.py in said templatetags/ dir? > > On Tue, Jul 14, 2009 at 3:58 PM, kcharvey <[email protected]> wrote: > > > I'm very new to Satchmo and somewhat new to Django. I'm trying to > > customize the {% category_tree %} template tag from satchmo_store/shop/ > > templatetags in order to add some classes for some jQuery. I copied > > satchmo_category.py into my own app (shop_customizations), changed the > > name of the file to satchmo_category_kevin.py, and changed base.html > > to {% load satchmo_category_kevin %}. The site runs fine, including > > the navigation, but changes to the navigation code don't show up. I > > know it's using my copy of the code because if I change > > > register.simple_tag(category_tree) > > > to > > > register.simple_tag(category_tree_kevin) > > > It breaks the site. Then, if I fix the template tag call to {% > > category_tree_kevin %} it works again. My test is changing line 22: > > > attrs["class"] = "current" > > > to > > > attrs["class"] = "kevin" > > > The current selected link remains <a class="current"> instead of <a > > class="kevin">. > > > I know this is a total newbie question, probably a Django deal, hoping > > it's a simple fix. Thanks in advance for your help! > > > Kevin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Satchmo users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/satchmo-users?hl=en -~----------~----~----~----~------~----~------~--~---
