Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I'm not a fluent pythonist, but wouldn't you achieve the same result by renaming your "request" argument to "self" ?

Before: > def flash_success(request, body, title=''): > request.session.flash({'body': body, 'title': title'})

After: > def flash_success(self, body, title=''): > self.session.flash({'body': body, 'title': title'})



I believe the point was to unify request.session.flash(…) with things like helpers.flash_success(request,…) such that both flash and flash_success can be methods on the request object.


Yep, this is correct.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: