      if len(bits) < 2:
          return value # Invalid arg.
      try:
          yes, no, maybe = bits
      except ValueError: # unpack list of wrong size (no "maybe" value provided)
          yes, no, maybe = bits[0], bits[1], bits[1]
      if value is None:
          return maybe
      if value:
          return yes
 
</s> remove     except ValueError: # invalid string that's not a number
 </s> add     except ValueError: # Invalid string that's not a number. </s> remove     except TypeError: # value isn't a string or a number; maybe it's a list?
 </s> add     except TypeError: # Value isn't a string or a number; maybe it's a list? </s> remove     except ValueError: # invalid literal for int()
 </s> add     except ValueError: # Invalid literal for int(). </s> remove         except TypeError: # len() of unsized object
 </s> add         except TypeError: # len() of unsized object. </s> remove     "If value is unavailable, use given default"
 </s> add     """If value is unavailable, use given default."""
    except ValueError:
        # Unpack list of wrong size (no "maybe" value provided).
      if len(bits) < 2:
          return value # Invalid arg.
      try:
          yes, no, maybe = bits
    except ValueError:
        # Unpack list of wrong size (no "maybe" value provided).
          yes, no, maybe = bits[0], bits[1], bits[1]
      if value is None:
          return maybe
      if value:
          return yes
keep keep keep keep replace keep keep keep keep keep
 Style and import fixes.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@6641 bcc190cf-cafb-0310-a4f2-bffc1f526a37 
django/template/defaultfilters.py