def openid_icon(openid, user): oid = u"%s" % openid matches = [u.openid == oid for u in UserOpenidAssociation.objects.filter(user=user)] if any(matches): return mark_safe(u'<img src="%s" alt="%s" />' % ( os.path.join(settings.STATIC_URL, "images", "openid-icon.png"), ugettext("Logged in with OpenID") )) else: return u""
def OR(*l): # lets you run multiple permissions against a single state transition return lambda *args: any(f(*args) for f in l)