szulabs/stucampus — pull request #7 by shonenada (2013-08-29 05:53:24+00:00)
Title: Refactor/class base views

Convert the function view into class-base view.
Here are some issues I have no idea whether I deal with it well:

1. Long code in each http verb functions, there are many `if` and `else` in a function, for example:

```python
form = SignInForm(request.POST)
if form.is_valid():
email = request.POST['email']
password = request.POST['password']
user = authenticate(username=email, password=password)
if user is not None:
if user.is_active:
login(request, user)
user.student.login_count = user.student.login_count + 1
user.student.last_login_ip = get_client_ip(request)
user.student.save()
success = True
messages = '登录成功'
else:
success = False
messages = '账户停用'
else:
# user not found.
success = False
messages = '邮箱或密码错误'
else:
success = False
messages = form.errors.values()
return spec_json(success, messages)
```

2. Multi decorators in python files which in master/manage/, I don't know whether I should write a new combining decorator to combine multi decorator into one? Whether the issue described in https://blog.tonyseek.com/post/how-to-register-python-function-by-decorator/ would be happened?

3. I forgot = = I'll add when I think of it....

pls review. @szulabs @tonyseek @doyoubi