Commits

Branko Vukelic  committed 87140fb

Implemented __str__ method on UrlHelper

  • Participants
  • Parent commits 6759180

Comments (0)

Files changed (2)

File tests/test_url_helper.py

         u = UrlHelper('/foo/bar?foo=1&bar=2#foo')
         self.assertEqual(u.get_full_quoted_path(),
                          '/foo/bar%3Ffoo%3D1%26bar%3D2%23foo')
+
+    def test_use_as_string(self):
+        u = UrlHelper('/foo/bar')
+        u.query = dict(foo=1, bar=2)
+        u.fragment = 'baz'
+        self.assertEqual(str(u), '/foo/bar?foo=1&bar=2#baz')

File url_tools/helper.py

     def query_string(self, value):
         self.query_dict = QueryDict(value, mutable=True)
 
+    def __str__(self):
+        return self.get_full_path()