Search code examples
pythondjangosatchmo

AttributeError when using replace_urlpattern in Satchmo


I'm trying to override the default category view in Satchmo. I'm successfully overriding other views with no problems, but this one is throwing an error. Here is the code I'm using in my root urls.py to override the default category view:

replacement = url(r'^(?P<parent_slugs>([-\w]+/)*)?(?P<slug>[-\w]+)/$', 'pasma.custom_satchmo_views.category_view', {}, 'satchmo_category'),
replace_urlpattern(urlpatterns, replacement)

This is causing the following error:

Exception Type:     AttributeError
Exception Value:    'tuple' object has no attribute 'regex'

Does anyone have any idea how I can fix this?


Solution

  • Notice the trailing comma in your first line. You are assigning replacement a one-tuple containing the result of url() call: same as replacement = (url(...),).