Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Add some request-related global hooks.
Browse files Browse the repository at this point in the history
  • Loading branch information
spladug committed Mar 31, 2013
1 parent f7f5d26 commit e66ee5a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
10 changes: 5 additions & 5 deletions r2/r2/controllers/reddit_base.py
Expand Up @@ -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
Expand Down Expand Up @@ -84,7 +84,6 @@
from r2.models import (
All,
AllMinus,
check_request,
DefaultSR,
DomainSR,
FakeAccount,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
3 changes: 0 additions & 3 deletions r2/r2/models/admintools.py
Expand Up @@ -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
Expand Down

0 comments on commit e66ee5a

Please sign in to comment.