On 1 oct, 09:52, maverick <[EMAIL PROTECTED]> wrote:
> @keith, your suggestion seemed to be make a "real" request? I don't
> want to make real request since it's not light weight enough.
>
> @ Jeff, thanks.  I don't want to call from view, I want work with the
> "URL". But your suggestion is good, I will look inside django code to
> see how to do so.
>
Since Django provides an url -> views dispatch system, it shouldn't be
that hard to get the view from the url !-)

Not fully tested, but this should work:

from django.core.urlresolvers import resolve

def get_response_for_url(request):
    resolved = resolve('/path/part/of/url/')
    if resolved is None:
        # url didn't match...
        # either raise some exception or
        return None
    # ok, proceed
    view_func, args, kw = resolved
    return view_func(request, *args, **kw)

HTH

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to