Permalink
Browse files

Clean up a bunch of imports.

  • Loading branch information...
1 parent 6b82148 commit 55edce8fdaa331c262626a1f7c22ad114d55fcaf @spladug spladug committed Jun 16, 2012
Showing with 18 additions and 24 deletions.
  1. +0 −5 r2/r2/config/__init__.py
  2. +8 −10 r2/r2/config/environment.py
  3. +10 −9 r2/r2/config/middleware.py
View
@@ -19,8 +19,3 @@
# All portions of the code written by CondeNet are Copyright (c) 2006-2010
# CondeNet, Inc. All Rights Reserved.
################################################################################
-
-# ad tags
-ad_urls = {}
-
-
@@ -20,24 +20,22 @@
# CondeNet, Inc. All Rights Reserved.
################################################################################
import os
-
-#import pylons.config
-from pylons import config
-
import mimetypes
-mimetypes.init()
-import webhelpers
+from pylons import config
+import r2.config
+import r2.lib.helpers
from r2.config import routing
from r2.lib.app_globals import Globals
from r2.lib.configparse import ConfigValue
-import r2.lib.helpers
from r2.lib.plugin import PluginLoader
-import r2.config as reddit_config
-
from r2.templates import tmpl_dirs
+
+mimetypes.init()
+
+
def load_environment(global_conf={}, app_conf={}, setup_globals=True):
# Setup our paths
root_path = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
@@ -58,7 +56,7 @@ def load_environment(global_conf={}, app_conf={}, setup_globals=True):
g = config['pylons.g'] = Globals(global_conf, app_conf, paths)
if setup_globals:
g.setup()
- reddit_config.cache = g.cache
+ r2.config.cache = g.cache
config['pylons.h'] = r2.lib.helpers
View
@@ -20,25 +20,26 @@
# CondeNet, Inc. All Rights Reserved.
################################################################################
"""Pylons middleware initialization"""
+import re
+import urllib
+import tempfile
+import urlparse
+from threading import Lock
+
from paste.cascade import Cascade
from paste.registry import RegistryManager
-from paste.urlparser import URLParser, StaticURLParser
+from paste.urlparser import StaticURLParser
from paste.deploy.converters import asbool
-
-from pylons import config, request, Response
+from pylons import config, Response
from pylons.error import error_template
from pylons.middleware import ErrorDocuments, ErrorHandler, StaticJavascripts
from pylons.wsgiapp import PylonsApp, PylonsBaseWSGIApp
from r2.config.environment import load_environment
from r2.config.rewrites import rewrites
-from r2.config.extensions import extension_mapping, set_extension, api_type
-from r2.lib.utils import rstrips, is_authorized_cname
+from r2.config.extensions import extension_mapping, set_extension
+from r2.lib.utils import is_authorized_cname
-#middleware stuff
-import sys, tempfile, urllib, re, os, sha, subprocess, urlparse
-from httplib import HTTPConnection
-from threading import Lock
# hack in Paste support for HTTP 429 "Too Many Requests"
from paste import httpexceptions, wsgiwrappers

0 comments on commit 55edce8

Please sign in to comment.