I have thought a bit about the app_reverse problem when using an external django app as ApplicationContent.
Currently, to properly support url reversion, one has to modify the external app and replace each and every
django.core.urlresolver.reverse() call into
feincms.content.application.models.app_reverse(), which to boot also needs an additional urlconf parameter. That is undesirable because:
- it tightly couples the application to the FeinCMS environment, it's currently basically impossible to reuse an app without munging it
- it moves knowledge about the urlconf parameter into the individual views, where it obviously does not belong
I just committed a small change that at least allows one to curry the app_reverse like this
from functools import partial
from feincms.content.application.models import app_reverse
reverse = partial(app_reverse, urlconf='some.urls')
which helps with the first point a small bit, at least one does not need to change all the reverses individually. It should also be possible to wrap that in a
try/catch block to give the app at least a chance of working outside of a FeinCMS site.
However, you still need to inject knowledge about the urlconf into the app. The right place to get that knowledge from would obviously be the call to
create_content_type:
Page.create_content_type(ApplicationContent,
APPLICATIONS=( ('some_urls', 'Demoapp'),)
Any ideas how one could get rid of the verbatim urlconf in the app? Perhaps introspection of something? I'm pretty sure that urlconf is known at that point
somewhere....? Ideas?
Cheers,
mjl