Skip to content
This repository has been archived by the owner on Apr 29, 2023. It is now read-only.

gblock tag throws exception when given integer in comma-grouped slug #3

Closed
rennat opened this issue Feb 24, 2010 · 3 comments
Closed

Comments

@rennat
Copy link

rennat commented Feb 24, 2010

The assumed behaviour is that "page",page.id,"main_content" would become "page_1_main_content".

Instead throws TemplateSyntaxError:
Caught an exception while rendering: sequence item 1: expected string or Unicode, int found

Original Traceback (most recent call last):
  File "/Library/Python/2.5/site-packages/django/template/debug.py", line 71, in render_node
    result = node.render(context)
  File "/Users/tanner/virtualenvs/pinax-env/lib/python2.5/site-packages/django_generic_flatblocks-0.5dev-py2.5.egg/django_generic_flatblocks/templatetags/generic_flatblocks.py", line 91, in render
    slug = self.generate_slug(self.slug, context)
  File "/Users/tanner/virtualenvs/pinax-env/lib/python2.5/site-packages/django_generic_flatblocks-0.5dev-py2.5.egg/django_generic_flatblocks/templatetags/generic_flatblocks.py", line 32, in generate_slug
    return slugify('_'.join([self.resolve(i, context) for i in slug.split(',')]))
TypeError: sequence item 1: expected string or Unicode, int found
@rennat
Copy link
Author

rennat commented Feb 24, 2010

suggest simple coerce to string or unicode

addressed here: http://github.com/rennat/django-generic-flatblocks

@bartTC
Copy link
Owner

bartTC commented Feb 25, 2010

Yes this is a bug, but your patch does not work for me:

======================================================================
FAIL: testIntoArgument (django_generic_flatblocks.tests.GenericFlatblocksTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/martin/Workspace/django-generic-flatblocks/django_generic_flatblocks/tests/__init__.py", line 168, in testIntoArgument
    self.assertTrue(u'<foo>johndoe</foo>' in t)
AssertionError

======================================================================
FAIL: testSlugArgumentWithInteger (django_generic_flatblocks.tests.GenericFlatblocksTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/martin/Workspace/django-generic-flatblocks/django_generic_flatblocks/tests/__init__.py", line 70, in testSlugArgumentWithInteger
    self.assertTrue(self.dummy_user.username in t)
AssertionError

----------------------------------------------------------------------
Ran 9 tests in 0.267s

FAILED (failures=2)
Destroying test database...

@bartTC
Copy link
Owner

bartTC commented Feb 25, 2010

Fixed in 2fffc30 (Fixed issue #3. A slug could not have a integer as a part.)

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants