@environmentfilter
def do_attr(environment, obj, name):
 try:
  name = str(name)
 except UnicodeError:
  pass
 else:
  try:
   value = getattr(obj, name)
  except AttributeError:
   pass
  else:
   if (environment.sandboxed and (not environment.is_safe_attribute(obj, name, value))):
    return environment.unsafe_undefined(obj, name)
   return value
 return environment.undefined(obj=obj, name=name)

@ environmentfilter def do_attr ( environment , obj , name ) : try : name = str ( name ) except UnicodeError : pass else : try : value = getattr ( obj , name ) except AttributeError : pass else : if ( environment . sandboxed and ( not environment . is_safe_attribute ( obj , name , value ) ) ) : return environment . unsafe_undefined ( obj , name ) return value return environment . undefined ( obj = obj , name = name )
get an attribute of an object .