From 7bd66de38d3036905fd5c1aeabe1a7ce14ba36d8 Mon Sep 17 00:00:00 2001 From: Ben Jeffrey Date: Thu, 25 Jun 2015 22:14:58 +0100 Subject: [PATCH 1/6] PEP8-indented package file and added Django to required packages --- setup.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/setup.py b/setup.py index d7af184..62a084f 100644 --- a/setup.py +++ b/setup.py @@ -2,19 +2,19 @@ from humandt import __version__ setup(name='django-human-datetime', - version=__version__, - description='Uses the parsedatetime package to parse human readable date/time expressions into Django fields', - long_description=open('README.rst').read(), - author='Justin Quick', - author_email='justquick@gmail.com', - url='http://github.com/justquick/django-human-datetime', - packages=['humandt'], - requires=['parsedatetime','pytz',], - classifiers=['Development Status :: 4 - Beta', - 'Environment :: Web Environment', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Topic :: Utilities'], - ) + version=__version__, + description='Uses the parsedatetime package to parse human readable date/time expressions into Django fields', + long_description=open('README.rst').read(), + author='Justin Quick', + author_email='justquick@gmail.com', + url='http://github.com/justquick/django-human-datetime', + packages=['humandt'], + requires=['django', 'parsedatetime','pytz',], + classifiers=['Development Status :: 4 - Beta', + 'Environment :: Web Environment', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: BSD License', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Topic :: Utilities'], + ) From 44526005761e4ae22a7fb69ef632df914863457c Mon Sep 17 00:00:00 2001 From: Ben Jeffrey Date: Thu, 25 Jun 2015 22:15:53 +0100 Subject: [PATCH 2/6] Updated manage.py to Django 1.8 version --- example_project/manage.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/example_project/manage.py b/example_project/manage.py index 5e78ea9..f9726f9 100755 --- a/example_project/manage.py +++ b/example_project/manage.py @@ -1,11 +1,10 @@ #!/usr/bin/env python -from django.core.management import execute_manager -try: - import settings # Assumed to be in the same directory. -except ImportError: - import sys - sys.stderr.write("Error: Can't find the file 'settings.py' in the directory containing %r. It appears you've customized things.\nYou'll have to run django-admin.py, passing it your settings module.\n(If the file settings.py does indeed exist, it's causing an ImportError somehow.)\n" % __file__) - sys.exit(1) +import os +import sys if __name__ == "__main__": - execute_manager(settings) + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") + + from django.core.management import execute_from_command_line + + execute_from_command_line(sys.argv) From c29ca055280a3cb6afb1c9c4fd3bf8fd0de00e79 Mon Sep 17 00:00:00 2001 From: Ben Jeffrey Date: Thu, 25 Jun 2015 22:18:12 +0100 Subject: [PATCH 3/6] Updated unit test and fields modules to Python 3 syntax --- humandt/fields.py | 11 +++++------ humandt/tests.py | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/humandt/fields.py b/humandt/fields.py index b74d5d6..d84a3be 100644 --- a/humandt/fields.py +++ b/humandt/fields.py @@ -1,8 +1,7 @@ -import datetime from django.core import validators from django.core.exceptions import ValidationError from django.forms.fields import DateField, TimeField, DateTimeField -from parser import parse +from .parser import parse class HumanDateTimeField(DateTimeField): def to_python(self, value): @@ -10,7 +9,7 @@ def to_python(self, value): return None try: return parse(value) - except Exception, e: + except Exception as e: raise ValidationError(self.error_messages['invalid']) class HumanTimeField(TimeField): @@ -19,7 +18,7 @@ def to_python(self, value): return None try: return parse(value).time() - except Exception, e: + except Exception as e: raise ValidationError(self.error_messages['invalid']) class HumanDateField(DateField): @@ -28,5 +27,5 @@ def to_python(self, value): return None try: return parse(value).date() - except Exception, e: - raise ValidationError(self.error_messages['invalid']) \ No newline at end of file + except Exception as e: + raise ValidationError(self.error_messages['invalid']) diff --git a/humandt/tests.py b/humandt/tests.py index acef63e..5c3426d 100644 --- a/humandt/tests.py +++ b/humandt/tests.py @@ -1,5 +1,5 @@ -from django.test import TestCase -from parser import parse +from unittest import TestCase +from .parser import parse from datetime import datetime class HumanTests(TestCase): @@ -10,4 +10,3 @@ def test_tomorrow(self): t = parse('tomorrow 4PM') self.assertEqual(t.day, self.now.day+1) self.assertEqual(t.hour, 16) - From f29c9bae440e787e13d9fa3d209647bf37bcb835 Mon Sep 17 00:00:00 2001 From: Ben Jeffrey Date: Thu, 25 Jun 2015 22:19:29 +0100 Subject: [PATCH 4/6] Bumped version to 0.2 --- humandt/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/humandt/__init__.py b/humandt/__init__.py index 5e3048b..b650ceb 100644 --- a/humandt/__init__.py +++ b/humandt/__init__.py @@ -1 +1 @@ -__version__ = '0.1' \ No newline at end of file +__version__ = '0.2' From 88c2715b3c446bdd8c75b668a8c4fb46ed5a9716 Mon Sep 17 00:00:00 2001 From: Ben Jeffrey Date: Thu, 25 Jun 2015 22:37:59 +0100 Subject: [PATCH 5/6] =?UTF-8?q?Changed=20'requires'=20=E2=86=92=20'install?= =?UTF-8?q?=5Frequires'=20keyword=20in=20package=20setup=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 62a084f..e2a3661 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ author_email='justquick@gmail.com', url='http://github.com/justquick/django-human-datetime', packages=['humandt'], - requires=['django', 'parsedatetime','pytz',], + install_requires=['django', 'parsedatetime','pytz',], classifiers=['Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Intended Audience :: Developers', From 29c6318a8f12165fe187be830a097ea30dd92e80 Mon Sep 17 00:00:00 2001 From: Ben Jeffrey Date: Fri, 26 Jun 2015 19:08:26 +0100 Subject: [PATCH 6/6] updated setup.py with Python 3 and correct (Apache) license identifiers --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index e2a3661..dc87d80 100644 --- a/setup.py +++ b/setup.py @@ -13,8 +13,9 @@ classifiers=['Development Status :: 4 - Beta', 'Environment :: Web Environment', 'Intended Audience :: Developers', - 'License :: OSI Approved :: BSD License', + 'License :: OSI Approved :: Apache Software License', 'Operating System :: OS Independent', 'Programming Language :: Python', + 'Programming Language :: Python :: 3', 'Topic :: Utilities'], )