I think you're thinking overly complex, a simple decorator should do the trick (untested):
def proxy(view):
@wraps(view)
def wrapper(request, *args, **kwargs):
current_site = get_current_site(request)
try:
main_site = Site.objects.get(id=1).domain # or set this hard
except Site.DoesNotExist:
raise Http404
if current_site != main_site:
return HttpResponseRedirect('http://{0}{1}?next=http://{2}/'.format(
main_site, request.path, current_site)
)
return view(request, *args, **kwargs)
return wrapper
urls_site_b.py
urlpatterns = patterns('',
url(r'^foo/$', proxy(bar), name='bar'),
)
Now make sure urls_site_a.py also has this pattern (obviously you wouldn't need to decorate the view there).