def stringfilter(func):
 def _dec(*args, **kwargs):
  if args:
   args = list(args)
   args[0] = force_text(args[0])
   if (isinstance(args[0], SafeData) and getattr(_dec._decorated_function, u'is_safe', False)):
    return mark_safe(func(*args, **kwargs))
  return func(*args, **kwargs)
 _dec._decorated_function = getattr(func, u'_decorated_function', func)
 return wraps(func)(_dec)

def stringfilter ( func ) : def _dec ( * args , ** kwargs ) : if args : args = list ( args ) args [ 0 ] = force_text ( args [ 0 ] ) if ( isinstance ( args [ 0 ] , SafeData ) and getattr ( _dec . _decorated_function , u'is_safe' , False ) ) : return mark_safe ( func ( * args , ** kwargs ) ) return func ( * args , ** kwargs ) _dec . _decorated_function = getattr ( func , u'_decorated_function' , func ) return wraps ( func ) ( _dec )
decorator for filters which should only receive unicode objects .