mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 16:28:01 -05:00
Add some request-related global hooks.
This commit is contained in:
@@ -45,7 +45,7 @@ from pylons.i18n import _
|
||||
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.lib.validator import (
|
||||
from r2.models import (
|
||||
All,
|
||||
AllMinus,
|
||||
check_request,
|
||||
DefaultSR,
|
||||
DomainSR,
|
||||
FakeAccount,
|
||||
@@ -703,6 +702,7 @@ class MinimalController(BaseController):
|
||||
# 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 @@ class MinimalController(BaseController):
|
||||
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 @@ class RedditController(MinimalController):
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user