Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #684 (closed defect: invalid)

Opened 13 years ago

Last modified 12 years ago

Kid templates messing up!

Reported by: jpaulofarias at gmail dot com Owned by: anonymous
Priority: high Milestone: 0.9a2
Component: Kid Version: 0.9a1
Severity: blocker Keywords:
Cc:

Description

I've noticed kid is generating wrong code when u use some variable substitution.

This is the template I've used to test it from a quickstarted project:  http://tg.pastebin.com/623227

And this is the code it generates:  http://tg.pastebin.com/623226

Note the \n it puts inside the <script> tag.

Now, with this template:  http://tg.pastebin.com/623235

It generates code correctly:  http://tg.pastebin.com/623236

So something is wrong with the code for variable substitution I guess....

Change History

comment:1 Changed 13 years ago by jpaulofarias at gmail dot com

Patch to solve this problem:

Index: kid/parser.py
===================================================================
--- kid/parser.py       (revision 277)
+++ kid/parser.py       (working copy)
@@ -377,7 +377,7 @@
         line = code.line
         sub = interpolate(text)
         if isinstance(sub, list):
-            code.start_block('for _e in %r:' % sub)
+            code.start_block('for _e in %s:' % sub)
             code.line('for _e2 in template_util.generate_content(_e): yield _e2')
             code.end_block()
         else:

Hope it helps.

comment:2 Changed 13 years ago by michele

JP,

what python version are you running?

cito (from kid) tracked down the real problem:

 http://kid.lesscode.org/trac/ticket/138

comment:3 Changed 13 years ago by kevin

  • Status changed from new to closed
  • Resolution set to invalid

JP has confirmed that he's running Ubuntu Dapper which includes a version of Python that has a bug that causes this behavior. This is slated to be fixed in Python this week.

Note: See TracTickets for help on using tickets.