unai <u...@gisa-elkartea.org> wrote: >Hello, > >> given this approach, what if the third party app wants to self-extend >> a django admin template for example? > >I'm working on an other solution that instead of relying on loader >skipping >relies on template skipping. > >Imagine you extend to a self-reference from within a template. All the >templates are ignored until the very same template is skipped and it >then >continues normally. > >This allows for apps to extend other apps and for filesystem templates >to >extend other TEMPLATE_DIR roots while order is respected. > >Now, the tricky part is to identify a template uniquely. I went for >hashing >but, as Apollo13 said on IRC, that's just too expensive. After looking >for a >while, it seems that both filesystem and app loaders work with absolute >paths. >It seems to me the best way to identify a template uniquely. > >The beauty of the solution is that template skipping is totally >relegated to >app and filesystem loaders. Of course, some changes in >django.template.loader >are needed but they are minor. > >I'm currently having some debugging issues and I'm quite busy with >other things >but I'll try to provide a complete PR this following week. > >If you can think of any problems that this solution would arise don't >hesitate >in telling ;) > > >Best wishes, > >Unai Zalakain
I tend to warn people off thinking of template names as paths. It's an implementation detail that they are treated as such by the two default loaders. Case in point, my gnocchi-cms app is not the only one I've encountered where template names are used to look up a table for the contents. Requiring each loader to include an unique id with each template (even if it's just a full path) seems the easiest solution. Older 3rd party loaders which don't do this would not be able to participate, clearly. [The other reason I discourage this thinking is it helps people to stop trying to us relative paths when referencing templates] -- Sent from my Android device with K-9 Mail. Please excuse my brevity. -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/3615b2cc-95fd-44c3-8115-d7f3b48e29cb%40email.android.com. For more options, visit https://groups.google.com/groups/opt_out.