Posts Tagged ‘tips’

Debugging Django {% url %} tag

Wednesday, February 6th, 2008

When you sometimes notice that {% url %} tag does not work for your named urls, then debugging it is easy. Start the python shell:

import app.views
from django.core.urlresolvers import reverse
reverse('named-view-to-be-tested')

If the view doesn’t work, it will either return NoReverseMatch: Not enough positional arguments passed in exception or url.

Thanks to jodal from #django for the tip.

“Injecting” packages in Gentoo

Saturday, December 8th, 2007

As I needed a bit more recent kernel on one machine due to some exotic hardware, I didn’t want to use regular kernel provided by portage. Instead I opted to track latest Linus’s snapshot using git. Although there are snapshot kernel packages in the portage their usage is a bit cumbersome because every time new release is made and you update it, kernel sources will land into different directory… Managing these will become quite cumbersome… ;)
There was also another gotcha: removing all the kernels provided by portage made it unhappy as it wants to have at least one installed kernel. First I though I can just use the ‘–inject’ option to insert the package by not installing it, but unfortunately this feature has been removed ages ago ;)
Fortunately the feature itself hadn’t been removed as it is possible to use either /etc/portage/package.mask or /etc/portage/profile/package.provided. package.mask isn’t suitable to use because there are some packages I use that depend on kernel package, so I had to use second option. But it took a while to figure out how to ignore all the versions because the package atom has to be provided with version number. So, in order to “inject” a package into system one has to use similar form:
sys-kernel/gentoo-sources-9999