Nanomobil fährt auf Gold: The structure, which consists of carbon, oxygen, and hydrogen, is about three nanometers wide and two nanometers long. And let someone say again that Japanese cars are small ...
Archive 22. October 2005
to flock - to gather
I don't know if the above is the right motto for me. Bookmarks in del.icio.us. Pictures in Flickr. Somehow, I prefer to have this stuff with me rather than with some central hosts.
What they do right: automatic indexing of page content, so you can find it again. If there were also an OS X version where the browser is really an OS X application (and not just an application that runs on OS X), that could really be appealing.
Version Control with SVK
Version Control with SVK is an online book about SVK - a distributed version system that works very well with SVN and CVS (among others). And it offers quite a relief especially for working with patches for upstream systems and for local forks of open source software.
The book is far from complete, but you can already find quite a lot of information in it.
very simple view functions
Sometimes you have a bunch of really simple view functions in your django project (yes, this is for your, bitprophet! ). View functions that are actually not more than just a render to response call - take a template, take some data from the request, stuff them in and render a response. It's rather boring to write them down and it breaks the DRY principle. So what to do? Write your own generic view.
from django.core.extensions \
import render_to_response
def simple_view(request, template, **kwargs):
return render_to_response(
template, kwargs)
That's all. A simple and nice view function that just does that - render a template. It even can be fed with context variables from the urlpattern. Use it like this in your urlconf:
urlpatterns = patterns('',
(r'^page/(?P<arg>.*)/$', 'cool.simple_view',
{'template': 'app/mytemplate'}),
)
That way a /page/foo/ view would be routed to the 'app/mytemplate' template with a context that just includes the variable 'arg' with the value 'foo'. And you never will need to write those simple_view functions again. For extra spices you could throw in a context_instance = DjangoContext(request) into the render to response call to even get the authenticated user and stuff like that from the request.