0001-misc-don-t-get-into-category-path-if-a-formdef-exist.patch
tests/test_form_pages.py | ||
---|---|---|
4992 | 4992 |
formdata.store() |
4993 | 4993 |
resp = app.get(formdata.get_url()) |
4994 | 4994 |
assert 'The form has been recorded' in resp.body |
4995 | ||
4996 |
def test_form_and_category_same_slug(pub): |
|
4997 |
FormDef.wipe() |
|
4998 |
formdef = FormDef() |
|
4999 |
formdef.name = 'foobar' |
|
5000 |
formdef.fields = [] |
|
5001 |
formdef.store() |
|
5002 | ||
5003 |
# check we get to the form, not the category |
|
5004 |
resp = get_app(pub).get('/foobar/') |
|
5005 |
assert resp.form |
wcs/root.py | ||
---|---|---|
39 | 39 |
from qommon.afterjobs import AfterJobStatusDirectory |
40 | 40 | |
41 | 41 |
from categories import Category |
42 |
from formdef import FormDef |
|
42 | 43 |
from data_sources import NamedDataSource |
43 | 44 |
from wscalls import NamedWsCall |
44 | 45 |
from wcs.api import ApiDirectory |
... | ... | |
342 | 343 |
except KeyError: |
343 | 344 |
pass |
344 | 345 |
else: |
345 |
return forms.root.RootDirectory(category) |
|
346 |
# redirect to category if there's not a formdef with same slug |
|
347 |
try: |
|
348 |
formdef = FormDef.get_by_urlname(component) |
|
349 |
except KeyError: |
|
350 |
return forms.root.RootDirectory(category) |
|
346 | 351 | |
347 | 352 |
# or a form ? |
348 | 353 |
return forms.root.RootDirectory()._q_lookup(component) |
349 |
- |