Thank you James, it's really great to get such answers ! Template loaders is a handy feature, I made my own in minutes. People interested can find it here :
http://www.djangosnippets.org/snippets/326/ Cheers, Olivier On 19 juil, 02:03, "James Bennett" <[EMAIL PROTECTED]> wrote: > On 7/18/07, olivier <[EMAIL PROTECTED]> wrote: > > > I'm thinking about a very simple processor that would remove lines > > beginning by ## (ala mako), because the Django comment syntax is sooo > > verbose and tedious to type.... > > You'll probably want to implement it as a custom template loader[1]; > Django ships with a couple of different loaders which have different > behaviors for locating templates, but there's no reason why you > couldn't write one which implements whatever preprocessing you want; a > template loader is simply a function which, given a template name and > a list of directories to search, locates and returns the appropriate > contents of a template file to be passed to the Template constructor. > > It'd be fairly easy to write one which, after loading the file, > performs whatever preprocessing you like on the contents before > handing them over (as a string); documentation on how to write > template loaders is a little bit scarce right now, but the bundled > loaders in django.template.loaders[2] provide helpful examples, and > there's also a third-party loader by Jannis Leidel which pulls > templates from a database[3] you might want to look at as an example > of rolling your own. > > [1]http://www.djangoproject.com/documentation/templates_python/#loading-... > [2]http://code.djangoproject.com/browser/django/trunk/django/template/lo... > [3]http://code.google.com/p/django-databasetemplateloader/ > > -- > "Bureaucrat Conrad, you are technically correct -- the best kind of correct." --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---