summaryrefslogtreecommitdiff
path: root/pypi.wsgi
diff options
context:
space:
mode:
authorDonald Stufft <donald@stufft.io>2013-06-17 15:19:12 -0400
committerDonald Stufft <donald@stufft.io>2013-06-17 15:19:12 -0400
commitaf64b4e42410f28bb6a42463be0773a0167b428a (patch)
tree882d74ce7a6028d0c57b3f58d7d0f2a0131c09cf /pypi.wsgi
parent7e677dd985338fd20e9344f4e9ceb84467c1be01 (diff)
downloaddecorator-af64b4e42410f28bb6a42463be0773a0167b428a.tar.gz
Revert back to the original pypi.wsgi
Diffstat (limited to 'pypi.wsgi')
-rw-r--r--pypi.wsgi31
1 files changed, 4 insertions, 27 deletions
diff --git a/pypi.wsgi b/pypi.wsgi
index f954be3..48a2220 100644
--- a/pypi.wsgi
+++ b/pypi.wsgi
@@ -1,17 +1,8 @@
#!/usr/bin/python
import sys
import os
-
-PREFIX = os.path.dirname(__file__)
-
-try:
- with open(os.path.join(PREFIX, "pypi.pth"), "r") as fp:
- path = fp.read().strip()
-except IOError:
- path = PREFIX
-
-sys.path.insert(0, path)
-
+prefix = os.path.dirname(__file__)
+sys.path.insert(0, prefix)
import cStringIO
import webui
import store
@@ -21,21 +12,7 @@ from functools import partial
store.keep_conn = True
-
-def find_nearest(directory, search):
- directory = os.path.abspath(directory)
- parts = directory.split(os.path.sep)
- for idx in xrange(len(parts)):
- d = os.path.sep.join(parts[:-idx])
- if not d:
- d = os.path.sep.join(parts)
- s = os.path.join(d, search)
- if os.path.isdir(s) or os.path.isfile(s):
- return d
- raise OSError
-
-
-CONFIG_FILE = os.path.join(find_nearest(PREFIX, "config.ini"), "config.ini")
+CONFIG_FILE = os.path.join(prefix, 'config.ini')
class Request:
@@ -43,7 +20,7 @@ class Request:
def __init__(self, environ, start_response):
self.start_response = start_response
try:
- length = int(environ.get('CONTENT_LENGTH', 0))
+ length = int(environ['CONTENT_LENGTH'])
except ValueError:
length = 0
self.rfile = cStringIO.StringIO(environ['wsgi.input'].read(length))