On Tue, 2009-01-27 at 18:07 -0800, Fluoborate wrote: > Hello All, > > I have a question. When I use the function > django.core.urlresolvers.reverse(), it works fine with args=(), and it > works fine with args=(string1, string2 [, ...more strings]), and it > even works fine with args=(anyOneCharacterLongString). However, if I > give it args=(multiCharacterString), it does not work.
This isn't anything to do with reverse(). It's a Python thing. The "args" argument has to be a sequence. A list or a tuple, for example. In Python, this is a tuple: ('a',) So is this: ('a', 'b') This, however, is not a tuple (a tuple must contain at least one comma, whether separating two or more items, or following a single item): ('a') (it's a one-character string). Now, a string is also a sequence, so if you pass in: ('fred') anything expecting a sequence will be able to iterate over that, getting respective elements of 'f', 'r', 'e' and 'd'. However, that's almost certainly not what you meant and it's different from ('fred',) -- which has a trailing comma and is thus a one-tuple. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---