The way I understand it, the reason templetor doesn't have builtins is
so that it's sandbox-able.  You can let your users write templates,
and don't have to worry about them doing anything except basic logic
checks or simple iterations.

If they had something like all builtins, you could do something like:
open('index.html', 'w').write('haha, i win')
or similarly bad things

Instead, templetor lets you choose which functions to make available.
It's also better form to keep the logic inside templates to a minimum,
so making you go the extra mile has made me stop and think about
whether a template solution is best.

This all being said, if you really want all builtins, you could do
this:

builtins = dir(__builtins__)

tglobals = {}

for b in builtins:
    tglobals[b] = eval(b)

template.Template.globals = tglobals



Cheers,
Justin

On Jan 17, 6:59 am, "Realazy XA Chen" <[EMAIL PROTECTED]> wrote:
> you need to set it for tempalte:
>
> template.Template.globals['range'] = range
>
> seehttp://webpy.org/templetor.
>
> p.s. so i suggest template can contain the builtins.
>
> On Jan 17, 2008 7:43 PM, slav0nic <[EMAIL PROTECTED]> wrote:
>
>
>
> > hi
> > for statement from function don't work in templatate
> > for example:
> > for i in range() does't work =( i must generate range() in main
> > program code
>
> > It is made specially? or bug?)
>
> --
> Laziness, DRY always.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/webpy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to