Re: template preprocessor ?

2007-07-20 Thread Jannis Leidel

as a matter of fact I just uploaded a new version [1] of the  
dbtemplates module, which is kind of pieced together from its  
original patch for a contrib app [2] and some ideas from james'  
django-registration app :)

it's a standalone app now and lives on the python path. installation  
and usage instructions included.
please don't hesitate to test it and complain [3] if it isn't working.

best,
jannis

1: http://django-databasetemplateloader.googlecode.com/files/ 
dbtemplates-0.2.tar.gz
2: http://code.djangoproject.com/attachment/ticket/632/dbtemplates4.diff
3: http://code.google.com/p/django-databasetemplateloader/issues/list

Am 19.07.2007 um 02:03 schrieb James Bennett:

> 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.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Cheetah-like comments [was: Re: template preprocessor ?]

2007-07-18 Thread olivier

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
-~--~~~~--~~--~--~---



Re: template preprocessor ?

2007-07-18 Thread James Bennett

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-templates
[2] http://code.djangoproject.com/browser/django/trunk/django/template/loaders
[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
-~--~~~~--~~--~--~---



template preprocessor ?

2007-07-18 Thread olivier

Hi group,

Is there an easy way to plug a preprocessor to the templating system ?

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

Cheers,

  Olivier


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---