Remove r2admin hooks obviated by pluginization.

The private code is becoming a plugin, so a lot of the special-case
infrastructure for it can be handled by the plugin stuff instead.
This commit is contained in:
Neil Williams
2012-09-02 01:00:11 -07:00
parent 78501dbf6d
commit 86f920fa32
9 changed files with 3 additions and 112 deletions

View File

@@ -1,29 +0,0 @@
# The contents of this file are subject to the Common Public Attribution
# License Version 1.0. (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
# License Version 1.1, but Sections 14 and 15 have been added to cover use of
# software over a computer network and provide for limited attribution for the
# Original Developer. In addition, Exhibit A has been modified to be consistent
# with Exhibit B.
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
# the specific language governing rights and limitations under the License.
#
# The Original Code is reddit.
#
# The Original Developer is the Initial Developer. The Initial Developer of
# the Original Code is reddit Inc.
#
# All portions of the code written by reddit are Copyright (c) 2006-2012 reddit
# Inc. All Rights Reserved.
###############################################################################
def add(mc):
mc('/admin/', controller='awards')
try:
from r2admin.config.routing import *
except ImportError:
pass

View File

@@ -30,7 +30,6 @@ import r2.lib.helpers
from r2.config import routing
from r2.lib.app_globals import Globals
from r2.lib.configparse import ConfigValue
from r2.templates import tmpl_dirs
mimetypes.init()
@@ -42,7 +41,7 @@ def load_environment(global_conf={}, app_conf={}, setup_globals=True):
paths = {'root': root_path,
'controllers': os.path.join(root_path, 'controllers'),
'templates': tmpl_dirs,
'templates': [os.path.join(root_path, 'templates')],
}
if ConfigValue.bool(global_conf.get('uncompressedJS')):

View File

@@ -26,7 +26,6 @@ Setup your Routes options here
import os
from routes import Mapper
from pylons import config
import admin_routes
def make_map():
map = Mapper()
@@ -35,7 +34,7 @@ def make_map():
for plugin in config['r2.plugins']:
plugin.add_routes(mc)
admin_routes.add(mc)
mc('/admin/', controller='awards')
mc('/login', controller='forms', action='login')
mc('/register', controller='forms', action='register')
@@ -102,8 +101,6 @@ def make_map():
mc('/admin/errors', controller='errorlog')
mc('/admin/:action', controller='admin')
mc('/user/:username/about', controller='user', action='about',
where='overview')
mc('/user/:username/:where', controller='user', action='listing',

View File

@@ -72,17 +72,12 @@ def load_controllers():
from querycontroller import QueryController
try:
from r2admin.controllers.adminapi import ApiController
except ImportError:
from api import ApiController
from api import ApiController
from api import ApiminimalController
from api_docs import ApidocsController
from apiv1 import APIv1Controller
from oauth2 import OAuth2FrontendController
from oauth2 import OAuth2AccessController
from admin import AdminController
from redirect import RedirectController
from ipn import IpnController

View File

@@ -1,42 +0,0 @@
# The contents of this file are subject to the Common Public Attribution
# License Version 1.0. (the "License"); you may not use this file except in
# compliance with the License. You may obtain a copy of the License at
# http://code.reddit.com/LICENSE. The License is based on the Mozilla Public
# License Version 1.1, but Sections 14 and 15 have been added to cover use of
# software over a computer network and provide for limited attribution for the
# Original Developer. In addition, Exhibit A has been modified to be consistent
# with Exhibit B.
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
# the specific language governing rights and limitations under the License.
#
# The Original Code is reddit.
#
# The Original Developer is the Initial Developer. The Initial Developer of
# the Original Code is reddit Inc.
#
# All portions of the code written by reddit are Copyright (c) 2006-2012 reddit
# Inc. All Rights Reserved.
###############################################################################
from r2.controllers.reddit_base import RedditController
from r2.controllers.reddit_base import base_listing
from r2.controllers.validator import *
from r2.lib.pages import *
from r2.models import *
from pylons.i18n import _
def admin_profile_query(vuser, location, db_sort):
return None
class AdminController(RedditController): pass
try:
from r2admin.controllers.admin import *
except ImportError:
pass

View File

@@ -45,7 +45,6 @@ from r2.lib.promote import randomized_promotion_list, get_promote_srid
import socket
from api_docs import api_doc, api_section
from admin import admin_profile_query
from pylons.i18n import _
from pylons import Response
@@ -621,9 +620,6 @@ class UserController(ListingController):
elif c.user_is_sponsor and self.where == 'promoted':
q = promote.get_all_links(self.vuser._id)
elif c.user_is_admin:
q = admin_profile_query(self.vuser, self.where, desc('_date'))
if q is None:
return self.abort404()

View File

@@ -459,8 +459,6 @@ class Globals(object):
(self.reddit_host, self.reddit_pid,
self.short_version, datetime.now()))
initialize_admin_globals(self)
def record_repo_version(self, repo_name, git_dir):
"""Get the currently checked out git revision for a given repository,
record it in g.versions, and return the short version of the hash."""
@@ -559,11 +557,3 @@ class Globals(object):
here.
"""
pass
def initialize_admin_globals(g):
pass
try:
from r2admin.lib.app_globals import initialize_admin_globals
except ImportError:
pass

View File

@@ -1435,8 +1435,3 @@ def process_votes(qname, limit=0):
cheater = cheater, foreground=True, timer=timer)
amqp.consume_items(qname, _handle_vote, verbose = False)
try:
from r2admin.lib.admin_queries import *
except ImportError:
pass

View File

@@ -20,13 +20,3 @@
# Inc. All Rights Reserved.
###############################################################################
import os
tmpl_dirs = [os.path.dirname(os.path.abspath(__file__))]
try:
from r2admin import templates as admin
except ImportError:
import admin
tmpl_dirs.append(os.path.dirname(admin.__file__))