Hi, I have the view function in django that written like a dispatcher calling other functions depending on the variable in request.GET, like this:
action = ''
for act in ('view1', 'view2', 'view3', 'view4', ... ):
if act in request.GET:
action = act
break
...
if action == '':
response = view0(request, ...)
elif action == 'view1':
response = view1(request, ...)
elif action == 'view2':
response = view2(request, ...)
...
The global dispatcher function contains many variable initialization routines and these variables are then used in viewXX functions.
So I feed that this is bad view design but I don't know how I can rewrite it?