'''
Created on Apr 25, 2013

@author: noob
'''
from django import template
import traceback
import logging


register = template.Library()

@register.filter(name='lookup')
def get_item(dictionary, key):
#     logging.debug("looking up %s in %s", key, dictionary)
    try:
        return dictionary.get(key, '')
    except Exception, exc:
        logging.debug("%s %s %s", dictionary, key, traceback.format_exc(exc))
        return ""
