How is_authenticated() is done in Django?

I tried to understand how is_authenticated() is done in Django, so I did a code search in Django's GitHub repository and found two definitions of it in django/contrib/auth/models.py as shown below:

I am surprised that one definition always return true, while the other always return false, as I was expecting some sort of logic to check if a user is logged or not.

Turn out it is simpler than that. The is_authenticated() method is bound to either a User object or an AnonymousUser object. So at the time is_authenticated() is called, it already knows whether the user is authenticated or not by the type of the object.



Getting back the terminal border in Ubuntu 14.04 LTS

I have set my gnome-terminal colors green on black (easy for my eyes).

Unfortunately the gnome-terminal application in Ubuntu 14.04 LTS does not have a border by default, making it difficult for me to get hold of the boundary of overlapping terminal windows, especially I have set my background to black as well (to conserve battery life).

Assuming Ambiance is the active theme, the following change is how I get the terminal border back:

$ vim /usr/share/themes/Ambiance/gtk-3.0/apps/unity.css


UnityDecoration {
    -UnityDecoration-extents: 28px 0 0 0;


UnityDecoration {
    -UnityDecoration-extents: 28px 1px 1px 1px;