You're probably doing this:
$ git branch | grep \*
* master
Try this:
$ git rev-parse --symbolic-full-name HEAD
refs/heads/master
Substantial typing required, though.
This monkey-patches django.tests.testcases.TestCase
so that all tests in a TestCase
take place in a BEGIN
transaction, while test methods take place in a nested transaction, with a savepoint being recorded after fixtures are loaded before a test, and rolling back to it after ...
Afaik, only the Oracle and Postgres backends has this; sqlite already has it for almost a year now, but there still isn't support for it in django.
I've posted a patch for inclusion; it'll be interesting to see how it goes.
Perusing the builtin-sqlite3 docs, as well as those of pysqlite, doesn't seem to offer much clue to using these.
After lots of hair-tearing, I think I've got it figured out.
Here's what most people usually do on their first try:
cur1.execute("create table test(i)")
cur1 ...
For TestCases that use yaml fixtures, and/or if your app contains initial data fixtures, they'll get loaded and parsed for every test method - yep, you read that right.
You can get a nice performance boost by caching parsed yaml fixtures/memoization.
Edit: Note that this won't kick ...
You'll notice that requests to this blog's feed no longer redirects to Feedburner, as I've decided to do away with it.
Right now, FB doesn't offer meaningful statistics, since readership is negligible. Also, doing 301 redirects outside of the site, as my implementation does, is suboptimal ...
In case you're wondering, the syntax/format is similar to what you would use for specifying dependencies in a setup.py
.
Here's a fairly complex example of loading a recent django 1.1, but not 1.2:
>>> from pkg_resources import require
>>> require("django >=1.1, <1.2")
[django ...
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 ...