> You could try something like: > > args = iter(args) # may need args.__iter__() in earlier Pythons? > for func in args: > arg = next(args) # may need args.next() in earlier Pythons? > ... > > > if func in list_of_allowed_funcs: > > func(arg) > > return HttpResponse('whatever')
Yes, I know it won't run as written. You also can't call func(arg) directly, since func is a string, not a callable -- Python being what it is, there's a way to find the callable based on the name, but I'd have to look it up at the moment. Or you could use a dict_of_allowed_callables to look up the callable based on a string that may not be the same as the callable name. > Oops. I omitted to point out (though the OP picked it up) that a > repeated group in a regex only leaves behind its last match in the match > object's groups. It's all going to get a bit painful trying to do this > with a urlconf. Ah, there's something I didn't know. There must be *some* way to get all matches from a Python regex, though, isn't there? -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.