Workout With Friends
Stay fit with a little motivation
 All Classes Namespaces Files Functions Variables Properties
requests.py
Go to the documentation of this file.
1 ##
2 #
3 # Custom pyramid request objects.
4 #
5 
6 from beaker.cache import CacheManager
7 from pyramid.decorator import reify
8 from pyramid.request import Request
9 from wowf.lib.auth import Auth
10 
11 
12 class RequestFactory(Request):
13 
14  @reify
15  ##
16  #
17  # Return the currently logged in user.
18  #
19  def user(self):
20  return Auth.get_current_user()
21 
22  @property
23  ##
24  #
25  # Return a beaker cache object for quick and dirty caching.
26  #
27  def cache(self):
28  if not hasattr(self, '_cache'):
29  self._cache = CacheManager()
30  return self._cache
31