Skip to content

Commit

Permalink
Always use os.path.abspath(__file__) instead of just __file__
Browse files Browse the repository at this point in the history
  • Loading branch information
mjumbewu committed Dec 9, 2014
1 parent e8e6190 commit 972fd48
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
# serve to show the default.

import sys, os
from os.path import join, dirname
from os.path import join, dirname, abspath

here = dirname(__file__)
here = dirname(abspath(__file__))
def get_version():
fh = open(join(here, "..", "jstemplate", "__init__.py"))
try:
Expand Down
2 changes: 1 addition & 1 deletion jstemplate/finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def _get_app_template_dirs():
mod = import_module(app)
except ImportError as e:
raise ImproperlyConfigured("ImportError %s: %s" % (app, e.args[0]))
app_dir = os.path.dirname(mod.__file__)
app_dir = os.path.dirname(os.path.abspath(mod.__file__))
for dirname in conf.JSTEMPLATE_APP_DIRNAMES:
template_dir = os.path.join(app_dir, dirname)
if os.path.isdir(template_dir):
Expand Down
2 changes: 1 addition & 1 deletion jstemplate/tests/project/project/settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import sys
import os

DIR = os.path.dirname(__file__)
DIR = os.path.dirname(os.path.abspath(__file__))
BASE_DIR = os.path.join(DIR, '..', '..', '..', '..')
sys.path.insert(0, os.path.abspath(BASE_DIR))

Expand Down
2 changes: 1 addition & 1 deletion jstemplate/tests/test_finders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"FilesystemRegexFinderTest"]


here = os.path.abspath(os.path.dirname(__file__))
here = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))



Expand Down
2 changes: 1 addition & 1 deletion jstemplate/tests/test_makemessages.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from .utils import override_settings

DIR = os.path.join(os.path.dirname(__file__), "project", "project", "jstemplates")
DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "project", "project", "jstemplates")

class MonkeyPatchedTemplatizeTest (TestCase):

Expand Down
2 changes: 1 addition & 1 deletion jstemplate/tests/test_translation.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
]


DIR = os.path.join(os.path.dirname(__file__), "templates")
DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates")


class I18nTest (TestCase):
Expand Down
2 changes: 1 addition & 1 deletion jstemplate/tests/test_ttag.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
]


DIR = os.path.join(os.path.dirname(__file__), "templates")
DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "templates")


class BaseJSTemplateTagTestMixin (object):
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from os.path import join, dirname
from os.path import join, dirname, abspath

from setuptools import setup, find_packages

here = dirname(__file__)
here = dirname(abspath(__file__))

long_description = (open(join(here, "README.rst")).read() + "\n\n" +
open(join(here, "CHANGES.rst")).read() + "\n\n" +
Expand Down

0 comments on commit 972fd48

Please sign in to comment.