PageRenderTime 45ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/handlers/module/user/UserForums.py

https://gitlab.com/manoj-makkuboy/vikuit
Python | 39 lines | 14 code | 4 blank | 21 comment | 1 complexity | e1d8e3823f3be8107392a46a892fb319 MD5 | raw file
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. ##
  4. # (C) Copyright 2011 Jose Blanco <jose.blanco[a]vikuit.com>
  5. #
  6. # This file is part of "vikuit".
  7. #
  8. # "vikuit" is free software: you can redistribute it and/or modify
  9. # it under the terms of the GNU Affero General Public License as published by
  10. # the Free Software Foundation, either version 3 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # "vikuit" is distributed in the hope that it will be useful,
  14. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. # GNU Affero General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU Affero General Public License
  19. # along with "vikuit". If not, see <http://www.gnu.org/licenses/>.
  20. ##
  21. from handlers.BaseHandler import *
  22. from google.appengine.api import users
  23. class UserForums(BaseHandler):
  24. def execute(self):
  25. self.values['tab'] = '/module/user.list'
  26. nickname = self.request.path.split('/')[3]
  27. this_user = model.UserData.gql('WHERE nickname=:1', nickname).get()
  28. if not this_user:
  29. self.not_found()
  30. return
  31. # TODO: not show if the user profile is not public
  32. self.values['this_user'] = this_user
  33. query = model.Thread.all().filter('author', this_user).filter('parent_thread', None)
  34. self.values['threads'] = self.paging(query, 10, '-creation_date', this_user.threads, ['-creation_date'])
  35. self.render('templates/module/user/user-forums.html')