Permalink
Browse files

use six.text_type instead of unicode

  • Loading branch information...
1 parent 78e9f3d commit c67365805a68df777c29189a08c9bd74c5c7548c @graingert committed Apr 8, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 templatetag_sugar/tests/templatetags/demo_tags.py
@@ -3,6 +3,8 @@
from templatetag_sugar.register import tag
from templatetag_sugar.parser import Name, Variable, Constant, Optional, Model
+from six import text_type
+
register = template.Library()
@@ -14,18 +16,21 @@ def test_tag_1(context, val, asvar=None):
else:
return val
+
@tag(register, [Model(), Variable(), Optional([Constant("as"), Name()])])
def test_tag_2(context, model, limit, asvar=None):
objs = model._default_manager.all()[:limit]
if asvar:
context[asvar] = objs
return ""
- return unicode(objs)
+ return text_type(objs)
+
@tag(register, [Variable()])
def test_tag_3(context, val):
return val
+
@tag(register, [Optional([Constant("width"), Variable('width')]), Optional([Constant("height"), Variable('height')])])
def test_tag_4(context, width=None, height=None):
return "%s, %s" % (width, height)

0 comments on commit c673658

Please sign in to comment.