# ======= /urls.py ==============

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^someurl/',include('someapp.url_view')), 
)

# ======= /someapp/url_view.py ==

from django.http import HttpResponse
from tourl import tourl


@tourl(r'^and/$')
def and_(request):
    return HttpResponse('and')

@tourl(r'^gg/$')
def index(request):
    return HttpResponse('OK')

# ======= /someapp/tourl.py ==

from django.conf.urls.defaults import *
import sys
import functools
def tourl(url_patern,*args,**kwargs):
    def paramed_decorator(func):
        @functools.wraps(func)
        def decorated(self):
            return func(self)
        module =sys.modules[func.__module__]
        
        if not hasattr(module, 'urlpatterns'):
            module.urlpatterns = patterns('',)
              
        module.urlpatterns   += patterns('',
            url(url_patern,decorated,*args,**kwargs), 
        )
        return decorated 
    return paramed_decorator