Just wanted to note that as of 2.8.0 (just released), you can now
embed Python code blocks in templates.

This makes it easy to enter the debugger from inside a template:

  <?python import pdb; pdb.set_trace() ?>
  <div tal:condition="...">
     ...
  </div>

It works best if you're running in debug-mode since then the generated
source code is written out to disk, letting the debugger actually
"see" the code.

If you're an emacs user, consider binding this to M-p:

  (fset 'pdb-pi-set "<?python import pdb; pdb.set_trace() ?>")
  (global-set-key "\M-p" 'pdb-pi-set)

This extends on the common binding M-t:

  (fset 'pdb-set "import pdb; pdb.set_trace()")
  (global-set-key "\M-t" 'pdb-set)

Naturally, code blocks can be used for more than just debugging. I'm
not sure it's particularly useful. It allows you to write out a
Fibonacci-generator right from inside your templates – should you ever
need that.

Enjoy,

\malthe

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to pylons-discuss@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-discuss+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to