Skip to content

Prod Deploy #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,26 @@
USE_I18N = True
LANGUAGE_CODE = 'en'

PROJECT_APPS = ('pretty_times',)
PROJECT_APPS = ('pretty_times', )

INSTALLED_APPS = ('django_nose', ) + PROJECT_APPS

TEST_RUNNER = 'django_nose.NoseTestSuiteRunner'

SECRET_KEY = 'abc123'

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
2 changes: 1 addition & 1 deletion example/manage.py → manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
import sys

if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
15 changes: 4 additions & 11 deletions pretty_times/pretty.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from datetime import datetime
from django.utils.translation import pgettext, ugettext as _


__all__ = ("date", )


Expand All @@ -28,7 +27,7 @@ def date(time):
return get_large_increments(days, past)


def get_small_increments(seconds, past):
def get_small_increments(seconds, past): # noqa: C901
if seconds < 10:
result = _('just now')
elif seconds < 60:
Expand All @@ -44,7 +43,7 @@ def get_small_increments(seconds, past):
return result


def get_large_increments(days, past):
def get_large_increments(days, past): # noqa: C901
if days == 1:
result = past and _('yesterday') or _('tomorrow')
elif days < 7:
Expand All @@ -67,13 +66,7 @@ def get_large_increments(days, past):
def _pretty_format(diff_amount, units, text, past):
pretty_time = (diff_amount + units / 2) / units
if past:
base = pgettext(
'Moment in the past',
"%(amount)d %(quantity)s ago"
)
base = pgettext('Moment in the past', "%(amount)d %(quantity)s ago")
else:
base = pgettext(
'Moment in the future',
"in %(amount)d %(quantity)s"
)
base = pgettext('Moment in the future', "in %(amount)d %(quantity)s")
return base % dict(amount=pretty_time, quantity=text)
1 change: 0 additions & 1 deletion pretty_times/templatetags/prettytimes_tags.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from django.template import Library
from pretty_times import pretty


register = Library()


Expand Down
3 changes: 2 additions & 1 deletion pretty_times/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from datetime import datetime, timedelta, tzinfo

import mock
from django.utils import unittest
import unittest
from django.utils import translation
from django.template import Template, Context

Expand Down Expand Up @@ -40,6 +40,7 @@ class UTC(tzinfo):
"""based on example tzinfo classes from:
http://docs.python.org/release/2.5.2/lib/datetime-tzinfo.html
"""

def utcoffset(self, dt):
return timedelta(0)

Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
django
django>=1.8.9,<2
1 change: 1 addition & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-r test.txt
11 changes: 6 additions & 5 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
coverage
flake8
-r base.txt
coverage>=4.0.1,<5
flake8>=2.5.2,<3
nose>=1.2.1
django_nose
nosexcover
mock
django-nose>=1.4.2,<2
nosexcover>=1.0.10,<2
mock>=1.0.1,<2
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

setup(
name="django-pretty-times",
version='0.2.0',
version='0.3.1',
author="imtapps",
author_email="[email protected]",
description="pretty_times provides django template helpers for the py-pretty library.",
long_description=file('README.rst', 'r').read(),
long_description=open('README.rst', 'r').read(),
url="http://github.com/imtapps/django-pretty-times",
packages=find_packages(exclude=['example']),
install_requires=file('requirements/base.txt').read().split("\n"),
install_requires=open('requirements/base.txt').read().split("\n"),
include_package_data=True,
zip_safe=False,
classifiers=[
Expand Down
Loading