<body py:match="item.tag=='{http://www.w3.org/1999/xhtml}body'" py:attrs="item.items()">
<div py:match="item.tag=='{http://www.w3.org/1999/xhtml}div' and item.get(u'id')=='header'" py:attrs="item.items()" id="header">
<?python
h1 = [e for e in item[:] if e.tag == "{http://www.w3.org/1999/xhtml}h1"]
if h1:
h1 = h1[0]
item = [e for e in item[:] if e.tag != "{http://www.w3.org/1999/xhtml}h1"]
else:
h1 = ''
?>
<div id="nav">
<div py:replace="item[:]" />
<span py:if="tg.config('identity.on',False) and not 'logging_in' in locals()"
id="pageLogin">
<span py:if="tg.identity.anonymous">
<a href="${tg.url('/login')}">Login</a>
</span>
<span py:if="not tg.identity.anonymous">
<a href="${tg.url('/logout')}">Logout</a>
</span>
</span>
<div py:if="not tg.identity.anonymous" class="welcome">Welcome ${tg.identity.user.display_name}.</div>
</div>
<h1 py:replace="h1">Favourites</h1>
</div>