1. Matthew Schinckel
  2. werkzeug-main

Commits

mitsuhiko  committed 1a9c325

Version 0.5.1
-------------
fixed boolean check of :class:`FieldStorage`

  • Participants
  • Parent commits b2bd028
  • Branches default

Comments (0)

Files changed (7)

File CHANGES

View file
  • Ignore whitespace
 Werkzeug Changelog
 ==================
 
-Version 0.6
------------
+Version 0.5.1
+-------------
 (codename to be selected, release date yet unknown)
 
+- fixed boolean check of :class:`FieldStorage`
+
 
 Version 0.5
 -----------

File docs/_static/background.png

  • Ignore whitespace
Old
Old image
New
New image

File docs/_static/codebackground.png

  • Ignore whitespace
Old
Old image
New
New image

File tests/test_utils.py

View file
  • Ignore whitespace
     assert stream.read(1) == '2'
     assert stream.read() == '3'
     assert stream.read() == ''
+
+
+def test_file_storage_truthiness():
+    """Test FileStorage truthiness"""
+    fs = FileStorage()
+    assert not fs, 'should be False'
+
+    fs = FileStorage(StringIO('Hello World'), filename='foo.txt')
+    assert fs, 'should be True because of a provided filename'

File werkzeug/routing.py

View file
  • Ignore whitespace
                     self.subdomain and self.subdomain + '.' or '',
                     self.server_name,
                     self.script_name[:-1],
-                    path_info.lstrip('/')
+                    path_info.lstrip('/').encode(self.map.charset)
                 )))
             if rv is None:
                 continue
                             subdomain and subdomain + '.' or '',
                             self.server_name,
                             self.script_name[:-1],
-                            path.lstrip('/')
+                            path.lstrip('/').encode(self.map.charset)
                         )))
             if rule.redirect_to is not None:
                 if isinstance(rule.redirect_to, basestring):

File werkzeug/utils.py

View file
  • Ignore whitespace
         except:
             pass
 
+    def __nonzero__(self):
+        return bool(self.filename)
+
     def __getattr__(self, name):
         return getattr(self.stream, name)
 

File werkzeug/wrappers.py

View file
  • Ignore whitespace
 
     @cached_property
     def args(self):
-        """The parsed URL parameters as :class:`MultiDict`."""
+        """The parsed URL parameters as :class:`ImmutableMultiDict`."""
         return url_decode(self.environ.get('QUERY_STRING', ''), self.charset,
                           errors=self.encoding_errors,
                           cls=ImmutableMultiDict)
     @property
     def form(self):
         """Form parameters.  Currently it's not guaranteed that the
-        :class:`MultiDict` returned by this function is ordered in the same
-        way as the submitted form data.
+        :class:`ImmutableMultiDict` returned by this function is ordered in
+        the same way as the submitted form data.
         """
         self._load_form_data()
         return self._form