Skip to content
This repository has been archived by the owner on Feb 21, 2020. It is now read-only.

Django 1.8 #10

Open
wants to merge 6 commits into
base: master
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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ env:
- DJANGO=1.4.10
- DJANGO=1.5.5
- DJANGO=1.6.1
- DJANGO=1.8.17

matrix:
exclude:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Django>=1.4,<1.7
Django>=1.8
six>=1.4.0
2 changes: 1 addition & 1 deletion restlib2/http/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from django.core.handlers.wsgi import STATUS_CODE_TEXT
from httplib import responses as STATUS_CODE_TEXT
from restlib2.structures import AttrDict

STATUS_CODE_TEXT.setdefault(422, 'UNPROCESSABLE ENTITY')
Expand Down
3 changes: 2 additions & 1 deletion restlib2/mixins.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.template import Engine
from django.template import loader
from django.template import RequestContext
from django.http import HttpResponse
Expand All @@ -17,7 +18,7 @@ def render(self, request, context, status=codes.ok, content_type=None,
elif self.template_name:
template = loader.get_template(self.template_name)
else:
template = loader.Template(self.template_string)
template = Engine().from_string(self.template_string)

context = RequestContext(request, context)
content = template.render(context)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
'url': 'https://github.com/bruth/restlib2',

'install_requires': [
'django>=1.4',
'django>=1.8',
'six>=1.4.0',
],

Expand Down
18 changes: 9 additions & 9 deletions test_suite.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import os
import sys

os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
if __name__ == "__main__":
apps = sys.argv[1:]

from django.core import management
if not apps:
apps = [
'tests',
]

apps = sys.argv[1:]
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.settings")

if not apps:
apps = [
'tests',
]

management.call_command('test', *apps)
from django.core.management import execute_from_command_line
execute_from_command_line(['manage.py', 'test', 'tests'])
35 changes: 27 additions & 8 deletions tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

SECRET_KEY = '123abc'

Expand All @@ -13,15 +12,35 @@
ROOT_URLCONF = 'tests.tests'

INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'restlib2',
'tests',
# TODO sgithens - There seems to an issue when these are included,
# that the tests can't find the db tables to load the test fixtures.
# However, the unit tests still pass if these are not included...
# 'django.contrib.auth',
# 'django.contrib.contenttypes',
# 'restlib2',
# 'tests',
)

TEMPLATE_CONTEXT_PROCESSORS += (
'django.core.context_processors.request',
)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
"tests/templates/"
],
'OPTIONS': {
'context_processors': [
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.template.context_processors.debug',
'django.template.context_processors.i18n',
'django.template.context_processors.media',
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
]
}
},
]

LOGGING = {
'version': 1,
Expand Down
5 changes: 2 additions & 3 deletions tests/tests.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from calendar import timegm
from django.test.client import RequestFactory
from django.test import TestCase
from django.conf.urls import patterns, url
from django.conf.urls import url
from restlib2 import params
from restlib2.resources import Resource
from restlib2.mixins import TemplateResponseMixin
Expand Down Expand Up @@ -469,8 +469,7 @@ def get(self, request):
pass


urlpatterns = patterns('',
url(r'^$', TestResource(template_name='index.html')))
urlpatterns =(url(r'^$', TestResource(template_name='index.html')),)


class TemplateResourceTestCase(TestCase):
Expand Down