diff --git a/r2/r2/config/admin_routes.py b/r2/r2/config/admin_routes.py deleted file mode 100644 index 5453c2fd3..000000000 --- a/r2/r2/config/admin_routes.py +++ /dev/null @@ -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 diff --git a/r2/r2/config/environment.py b/r2/r2/config/environment.py index 7f745606c..2f23303fb 100644 --- a/r2/r2/config/environment.py +++ b/r2/r2/config/environment.py @@ -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')): diff --git a/r2/r2/config/routing.py b/r2/r2/config/routing.py index 1415ed60e..33c970fbe 100644 --- a/r2/r2/config/routing.py +++ b/r2/r2/config/routing.py @@ -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', diff --git a/r2/r2/controllers/__init__.py b/r2/r2/controllers/__init__.py index 269457465..a68730d12 100644 --- a/r2/r2/controllers/__init__.py +++ b/r2/r2/controllers/__init__.py @@ -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 diff --git a/r2/r2/controllers/admin.py b/r2/r2/controllers/admin.py deleted file mode 100644 index 3c98be1af..000000000 --- a/r2/r2/controllers/admin.py +++ /dev/null @@ -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 - - diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index 897497ac9..04982eae0 100755 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -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() diff --git a/r2/r2/lib/app_globals.py b/r2/r2/lib/app_globals.py index 466cefdb9..b2490d0bf 100755 --- a/r2/r2/lib/app_globals.py +++ b/r2/r2/lib/app_globals.py @@ -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 diff --git a/r2/r2/lib/db/queries.py b/r2/r2/lib/db/queries.py index 646ffdfbe..b906d2281 100755 --- a/r2/r2/lib/db/queries.py +++ b/r2/r2/lib/db/queries.py @@ -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 diff --git a/r2/r2/templates/__init__.py b/r2/r2/templates/__init__.py index 04244d519..90b6fc927 100644 --- a/r2/r2/templates/__init__.py +++ b/r2/r2/templates/__init__.py @@ -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__))