Skip to content

Commit

Permalink
Fix TypeError error when expires is set to None.
Browse files Browse the repository at this point in the history
Closes #814
  • Loading branch information
berkerpeksag committed Aug 18, 2015
1 parent 2ea3448 commit 2b6c013
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions jobs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,8 @@ def is_new(self):
def visible(self):
if self.status != self.STATUS_APPROVED:
return False
if self.expires <= timezone.now():
if self.expires and self.expires <= timezone.now():
return False

return True

@property
Expand Down
6 changes: 6 additions & 0 deletions jobs/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,9 @@ def test_display_location(self):

job2 = self.create_job(region='')
self.assertEqual(job2.display_location, 'Memphis, USA')

def test_expires_none(self):
# see issue #814
j1 = factories.ApprovedJobFactory()
j1.expires = None
self.assertTrue(j1.visible)
6 changes: 4 additions & 2 deletions pydotorg/settings/local.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
from .base import *

DEBUG = True
TEMPLATE_DEBUG = True
DEBUG = TEMPLATE_DEBUG = True

ALLOWED_HOSTS = ['*']

PYTHON_ORG_CONTENT_SVN_PATH='/Users/flavio/working_copies/beta.python.org/build/data'

HAYSTACK_CONNECTIONS = {
Expand Down

0 comments on commit 2b6c013

Please sign in to comment.