Permalink
Browse files

Add some request-related global hooks.

  • Loading branch information...
1 parent f7f5d26 commit e66ee5ad8c3c5ea2213438f61e96efa86e87d414 @spladug spladug committed Mar 21, 2013
Showing with 5 additions and 8 deletions.
  1. +5 −5 r2/r2/controllers/reddit_base.py
  2. +0 −3 r2/r2/models/admintools.py
@@ -45,7 +45,7 @@
from pylons.i18n.translation import LanguageError
from r2.config.extensions import is_api
-from r2.lib import filters, pages, utils
+from r2.lib import filters, pages, utils, hooks
from r2.lib.authentication import authenticate_user
from r2.lib.base import BaseController, abort
from r2.lib.cache import make_key, MemcachedError
@@ -84,7 +84,6 @@
from r2.models import (
All,
AllMinus,
- check_request,
DefaultSR,
DomainSR,
FakeAccount,
@@ -703,6 +702,7 @@ def pre(self):
# if an rss feed, this will also log the user in if a feed=
# GET param is included
set_content_type()
+
c.request_timer.intermediate("minimal-pre")
# True/False forces. None updates for most non-POST requests
c.update_last_visit = None
@@ -771,12 +771,10 @@ def post(self):
secure=getattr(v, 'secure', False),
httponly=getattr(v, 'httponly', False))
- end_time = datetime.now(g.tz)
-
if self.should_update_last_visit():
c.user.update_last_visit(c.start_time)
- check_request(end_time)
+ hooks.get_hook("reddit.request.end").call()
# this thread is probably going to be reused, but it could be
# a while before it is. So we might as well dump the cache in
@@ -1041,6 +1039,8 @@ def pre(self):
if not c.show_admin_bar:
g.stats.end_logging_timings()
+ hooks.get_hook("reddit.request.begin").call()
+
c.request_timer.intermediate("base-pre")
def post(self):
@@ -395,9 +395,6 @@ def filter_quotas(unfiltered):
else:
return baskets, None
-def check_request(end_time):
- pass
-
def send_system_message(user, subject, body):
from r2.lib.db import queries

0 comments on commit e66ee5a

Please sign in to comment.