Skip to content

add possibility to exclude/whitelist views belonging to specified module...#28

Closed
szelga wants to merge 1 commit intonoirbizarre:masterfrom
szelga:feature_url_apps
Closed

add possibility to exclude/whitelist views belonging to specified module...#28
szelga wants to merge 1 commit intonoirbizarre:masterfrom
szelga:feature_url_apps

Conversation

@szelga
Copy link
Contributor

@szelga szelga commented Jul 24, 2013

add possibility to exclude/whitelist views belonging to specified modules in javascript URL resolver.

the following settings are available for this feature:

JS_URLS_APPS

Default: None

Serialized applications whitelist. If this setting is specified, only URLs with views belonging to modules listed in will be serialized.

JS_URLS_APPS_EXCLUDE

Default: None

Serialized applications blacklist.
If this setting is specified, URLs with views belonging to modules listed in will not be serialized.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0%) when pulling 7960c0a on szelga:feature_url_apps into b61a05e on noirbizarre:master.

@noirbizarre
Copy link
Owner

I need to review in details this pull request before merging it.
I'll do it this week-end.

@noirbizarre
Copy link
Owner

Tests are missing.
I added some in your branch (bf0ca47).
Make them pass before I can merge it

I think it's a little bit trickier than you think :)

@szelga
Copy link
Contributor Author

szelga commented Jul 31, 2013

$ make test
Running test suite
Creating test database for alias 'default'...
.....s.....................s................................................................................................................................EEEEE...........
======================================================================
ERROR: test (djangojs.tests.test_javascript.DjangoJsTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 281, in test
    self.run_suite()
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
    self.phantomjs(self.phantomjs_runner, url, title=self.title)
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
    for item in parser.parse(output):
  File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
    for line in lines:
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
    process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

======================================================================
ERROR: test (djangojs.tests.test_javascript.JasmineTemplateTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 281, in test
    self.run_suite()
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
    self.phantomjs(self.phantomjs_runner, url, title=self.title)
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
    for item in parser.parse(output):
  File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
    for line in lines:
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
    process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

======================================================================
ERROR: test (djangojs.tests.test_javascript.JasmineTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 281, in test
    self.run_suite()
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
    self.phantomjs(self.phantomjs_runner, url, title=self.title)
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
    for item in parser.parse(output):
  File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
    for line in lines:
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
    process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

======================================================================
ERROR: test (djangojs.tests.test_javascript.QUnitTemplateTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 293, in test
    self.run_suite()
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
    self.phantomjs(self.phantomjs_runner, url, title=self.title)
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
    for item in parser.parse(output):
  File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
    for line in lines:
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
    process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

======================================================================
ERROR: test (djangojs.tests.test_javascript.QUnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 293, in test
    self.run_suite()
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 166, in run_suite
    self.phantomjs(self.phantomjs_runner, url, title=self.title)
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 139, in phantomjs
    for item in parser.parse(output):
  File "/home/szelga/soft/Projects/django.js/djangojs/tap.py", line 205, in parse
    for line in lines:
  File "/home/szelga/soft/Projects/django.js/djangojs/runners.py", line 103, in execute
    process = Popen(command, stdout=PIPE, stderr=STDOUT, universal_newlines=True)
  File "/usr/lib/python2.7/subprocess.py", line 679, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1249, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

----------------------------------------------------------------------
Ran 172 tests in 8.333s

FAILED (errors=5, skipped=2)
Destroying test database for alias 'default'...
make: *** [test] Error 1

are tests relevant to this pull request passed and what should i install for erroneous tests to be passed?

@noirbizarre
Copy link
Owner

You need to install PhantomJS if you want to run JavaScript tests in the console.

@szelga
Copy link
Contributor Author

szelga commented Aug 1, 2013

i perform checks like this:

for app in settings.JS_URLS_APPS:
    if mod_name[:len(app)] == app:

not like this

for app in settings.JS_URLS_APPS:
    if mod_name == app:

so that those settings extend to nested modules. that's why the last test fails (i haven't looked through the others yet). do you want me to change that? or, perhaps, i should add wildcards support (e.g., 'django.contrib.admindocs' is just for admindocs module, and 'django.contrib.admindocs.*' is for nested modules as well)?

@noirbizarre
Copy link
Owner

If the behavior is entirely specified and tested, you can do what you want.

My personnel preference goes to no wildcard support (to have the same behavior as other settings)

@szelga
Copy link
Contributor Author

szelga commented Aug 13, 2013

after some tinkering with this feature i decided that it would be too confusing to use it and i can't make it much less confusing.
i guess, URL namespaces are the way to go.

@szelga szelga closed this Aug 13, 2013
@noirbizarre
Copy link
Owner

I agree with you ! 👍

@szelga szelga deleted the feature_url_apps branch August 22, 2013 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants