Here's a quick script to append {% csrf_token %}
at the end of the opening <form>
tag across your html files:
$ grep -REli --include="*.html" "<form.+method[[:space:]]?=[[:space:]]?['\"]?post['\"]?" . \
| xargs sed -i -re "s|(<form.+method[^=]*=\W?post[^>]+>)|\1{% csrf_token %}|i"
For git users, you can use git-grep
instead of ...
Some time back, I wrote a library-helper for CodeIgniter that brings Django/Jinja template inheritance to CI views. There are a couple of implementations out there, but I decided to write my own as an exercise mostly, but also to keep closer to the original syntax and style.
It works ...
Recently, I suggested a fix for ListingContentGenerator
s - instead of setting, say, /tag/foo/1
, set only /tag/foo/
. I do have some doubts if this should be considered a 'fix'; from the existing code base, it looks like having a /tag/foo/1
was pretty much intentional.
Anyway, while ...
As some of you sharp-eyed readers have noticed - yes, the year-month archive pages were broken. The May one showed June entries, and the June one showed May ones.
Thanks to Nick Johnson for pointing this out.
I wanted to localize this blog to my timezone - after all, I live here, and not in a UTC region.
But this needed some work. Most GAE python developers (no pun intended) would have noticed the lack of timezone-awareness for datetime properties.
To add timezone-awareness in bloggart, I had to ...
I'm running a nginx installation on webfaction, and it's long bothered me that URL rewrites/redirects in nginx included the port number in the resulting host.
For example, if you had this piece of config
server {
listen 1001;
server_name foo.com;
location = / {
rewrite ^.*$ /under_construction redirect;
}
}
a hit on ...
This was cute. I was wondering why Analytics was reporting so many page views for my lowly blog - turns out bloggart was including the Analytics JS for /admin/
pages too.
Check out the fix here.
Recently, I noticed that after resolving merge conflicts, git commit
showed the full SHA-1.
For example, in my working tree for rctay-blog:
$ git log -1 # whereami?
f1a0068 (Merge branch 'rc/fix-atom' into rc/master, Tue May 25 13:29:30 2010 +0800, Tay Ray Chuan)
$ git merge rc/atom-last-modified
Auto-merging ...
Over the past 2 days, I've been adding a few topics branches/features to my bloggart fork.
<updated>
field. This is mostly useful for developers hacking the atom.xml
template.
/feeds/atom.xml
are ...It's been a long time coming - almost 7 months since the previous release. On the surface, it's marked as a minor release, but it's packed with many features, as well as several model-backward incompatibilities.
For a more detailed list of notable changes, check out Chris' announcement.
(Interestingly ...