Hello,

I would like to format a date variable in a template. If I have a
"date" variable (which contains datetime.date.today()), I get this
error when I write "$date.strftime('%m %Y')" in the template:


 <type 'exceptions.KeyError'> at /


   '__import__'

Python     templates/index.html in __template__, line 6
Web     GET http://localhost:8080/


   Traceback (innermost first)

   * |templates/index.html| in |__template__|
        0. $def with (user, rediffuseur, contrats, date)
        1. $var title: Page d'accueil
        2. <div id="menu"><a href="/">Accueil</a> <a
           href="/logout">Déconnexion</a></div>
        3. <div id="content">
        4. Société : $rediffuseur.nom<br>
        5. Utilisateur : $user.prenom $user.nom<br>
        6. $date.strftime("%m %Y")


If I just put "$date", that works but that not what I want. Is it a
bug ? The workaround is to put $date.strftime("%m %Y") into $date from
the python code but it's not very pretty.

Thanks,
Fabien Grumelard
--~--~---------~--~----~------------~-------~--~----~
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