Fix possible_topdir computing

Using sys.argv[0] is wrong: if you run /usr/bin/keystone, it will look for
templates in /usr/keystone/… which will not work. The template path is
relative to the version.py file, so using __file__ makes things work.

Change-Id: I90e930bbb320b148df0fb7234a824b3644bd7369
Signed-off-by: Julien Danjou <julien.danjou@enovance.com>
This commit is contained in:
Julien Danjou 2011-10-07 17:00:30 +02:00
parent 5fa576a1b7
commit 634cd664f7
2 changed files with 5 additions and 4 deletions

View File

@ -16,6 +16,7 @@ John Dickinson <me@not.mn>
John Eo <joon.eo@gmail.com>
Jorge L. Williams <jorge.williams@rackspace.com>
Josh Kearney <josh@jk0.org>
Julien Danjou <julien.danjou@enovance.com>
Kevin L. Mitchell <kevin.mitchell@rackspace.com>
Khaled Hussein <khaled.hussein@gmail.com>
Mark Gius <mgius7096@gmail.com>

View File

@ -1,12 +1,12 @@
import os
import sys
from webob import Response
# If ../../keystone/__init__.py exists, add ../ to Python search path, so that
# it will override what happens to be installed in /usr/(local/)lib/python...
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
os.pardir))
possible_topdir = os.path.normpath(os.path.join(os.path.abspath(__file__),
os.pardir,
os.pardir,
os.pardir))
from keystone import utils
from keystone.common import template, wsgi