Skip to content
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

fix startandularapp and make it django 1.8 compatible; makes tests python 3.4 compatilble, fix #35, fix #33 #37

Open
wants to merge 2 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
8 changes: 4 additions & 4 deletions djangular/management/commands/startangularapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ class Command(utils.SiteAndPathUtils, TemplateCommand):
"name in the current directory or optionally in the given "
"directory.")

if django.get_version() > "1.7":
if django.get_version() >= "1.7":
requires_system_checks = False
else:
requires_model_validation = False

def handle(self, app_name=None, target=None, **options):
mgmt.call_command('startapp', app_name, target, **options)
def handle(self, name, target=None, **options):
mgmt.call_command('startapp', name, target, **options)

# Override the options to setup the template command.
options.update({
Expand All @@ -28,5 +28,5 @@ def handle(self, app_name=None, target=None, **options):
})

super(Command, self).handle(
'app', app_name, target or app_name, **options)
'app', name, target or name, **options)

8 changes: 4 additions & 4 deletions djangular/tests/middleware.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,25 @@ def test_that_middleware_does_nothing_to_html_requests(self):
mware = middleware.AngularJsonVulnerabilityMiddleware()
mware.process_response(request.HttpRequest(), resp)

self.assertEqual(resp.content, '<html></html>')
self.assertEqual(resp.content, b'<html></html>')

def test_that_middleware_does_nothing_to_js_requests(self):
resp = response.HttpResponse(content_type='text/javascript', content='var blah = [];')
mware = middleware.AngularJsonVulnerabilityMiddleware()
mware.process_response(request.HttpRequest(), resp)

self.assertEqual(resp.content, 'var blah = [];')
self.assertEqual(resp.content, b'var blah = [];')

def test_that_middleware_does_nothing_to_invalid_json_requests(self):
resp = response.HttpResponse(content_type='application/json', content='[1, 2, 3]', status=400)
mware = middleware.AngularJsonVulnerabilityMiddleware()
mware.process_response(request.HttpRequest(), resp)

self.assertEqual(resp.content, '[1, 2, 3]')
self.assertEqual(resp.content, b'[1, 2, 3]')

def test_that_middleware_adds_prefix_to_valid_json_requests(self):
resp = response.HttpResponse(content_type='application/json', content='[1, 2, 3]')
mware = middleware.AngularJsonVulnerabilityMiddleware()
mware.process_response(request.HttpRequest(), resp)

self.assertEqual(resp.content, mware.CONTENT_PREFIX + '[1, 2, 3]')
self.assertEqual(resp.content, mware.CONTENT_PREFIX + b'[1, 2, 3]')