May 24, 2009 § Leave a comment
By default Mako HTML escapes all output.
To NOT have this behavior, change the setting of TemplateLookup in environment.py.
May 17, 2009 § Leave a comment
distance_of_time_in_words is a useful function that converts boring looking datetime into something more attractive (and SEO optimized) like: 30 seconds ago.
Pylons gain this functionality via WebHelper which blatantly inspired by Rails.
But, out of the box, this functionality does not exists in my templates. To enable it, I need to add this line in helpers.py:
from webhelpers.date import distance_of_time_in_words
May 15, 2009 § Leave a comment
distinct() method is accessible from Query object. The documentation is kind of obscure, so hopefully this post is helpful for others.
May 13, 2009 § Leave a comment
May 10, 2009 § Leave a comment
The documentations of SqlAlchemy gets better in every version, but I can never remember the steps of creating Engine, Index, and Session.
So, I created 3 minutes tutorial on how to define the ORM class using declaration_base(), build that table, populates, and fetch.
April 27, 2009 § Leave a comment
I want to store python object to JSON. Including a complex one (not just object that contains simple attributes).
Apparently, John Paulett has a need for that too. Here’s his code. The best part is: It uses CJSON! Bingo.