From 79d701a0c910ec9a8e671e09cb56ab04f6ebcb29 Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Tue, 22 Feb 2011 19:12:27 +1000 Subject: [PATCH] fixed some bugs --- .gitignore | 1 + django_tables/__init__.py | 32 ++++++++++++++++++++++---------- django_tables/tables.py | 1 - setup.py | 9 ++++++--- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index e1f1a7b..53b958f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,5 +2,6 @@ /*.komodoproject /MANIFEST /dist/ +/build/ /docs/_build/ /django_tables.egg-info/ diff --git a/django_tables/__init__.py b/django_tables/__init__.py index afe96dd..e44cdfa 100644 --- a/django_tables/__init__.py +++ b/django_tables/__init__.py @@ -1,21 +1,33 @@ -# -*- coding: utf-8 -*- -__version__ = (0, 2, 0, 'dev') +# -*- coding: utf8 -*- +# (major, minor, bugfix, "pre-alpha" | "alpha" | "beta" | "final", release | 0) +VERSION = (0, 2, 0, 'alpha', 0) def get_version(): - version = '%s.%s' % (__version__[0], __version__[1]) - if __version__[2]: - version = '%s.%s' % (version, __version__[2]) - if __version__[3] != '': - version = '%s %s' % (version, __version__[3]) + version = '%s.%s' % (VERSION[0], VERSION[1]) + if VERSION[2]: + version = '%s.%s' % (version, VERSION[2]) + if VERSION[3:] == ('alpha', 0): + version = '%s pre-alpha' % version + else: + if VERSION[3] != 'final': + version = '%s %s %s' % (version, VERSION[3], VERSION[4]) return version + # We want to make get_version() available to setup.py even if Django is not -# available or we are not inside a Django project (so we do distutils stuff). +# available or we are not inside a Django project. try: - # this fails if project settings module isn't configured - from django.contrib import admin + # http://docs.djangoproject.com/en/dev/topics/settings/ says:: + # + # If you don't set DJANGO_SETTINGS_MODULE and don't call configure(), + # Django will raise an ImportError exception the first time a setting is + # accessed. + # + from django.conf import settings + settings.DEBUG # will raise ImportError if Django isn't configured except ImportError: + # allow get_version() to remain available import warnings warnings.warn('django-tables requires Django to be configured (settings) ' 'prior to use, however this has not been done. Version information ' diff --git a/django_tables/tables.py b/django_tables/tables.py index db87cc2..686bd7b 100644 --- a/django_tables/tables.py +++ b/django_tables/tables.py @@ -8,7 +8,6 @@ from django.template.loader import get_template from django.template import Context from .utils import rmprefix, toggleprefix, OrderByTuple, Accessor from .columns import Column -from .memory import sort_table from .rows import Rows, BoundRow from .columns import Columns diff --git a/setup.py b/setup.py index 2dfeb42..ba5d8f7 100755 --- a/setup.py +++ b/setup.py @@ -1,5 +1,8 @@ # -*- coding: utf8 -*- -from distutils.core import setup +try: + from setuptools import setup +except ImportError: + from distutils.core import setup from distutils.command.install_data import install_data from distutils.command.install import INSTALL_SCHEMES import os @@ -86,6 +89,6 @@ setup( packages = packages, data_files = data_files, cmdclass = cmdclasses, - requires = ['django(>=1.1)'], - install_requires = ['django>=1.1'] + requires = ['Django(>=1.1)'], + install_requires = ['Django>=1.1'] ) -- 2.26.2