Commits  committed 5599ecb Merge


  • Participants
  • Parent commits 52e7925, 22a4d5d
  • Branches trunk

Comments (0)

Files changed (5)

File docs/contents.rst

File contents unchanged.

File docs/media.rst

+.. automodule::
+.. currentmodule::
+.. autofunction:: choose_height
+.. autofunction:: get_dimensions_pil
+.. autofunction:: get_dimensions

File docs/mimehelper.rst

+.. automodule:: webhelpers.mimehelper
+.. currentmodule:: webhelpers.mimehelper
+.. autoclass:: MIMETypes
+    :members:
+    :undoc-members:

File webhelpers/

 def choose_height(new_width, width, height):
     """Return the height corresponding to ``new_width`` that's proportional
-       to the original size (``width`` x ``height``).
+       to the original size (``width * height``).
     proportion = float(height) / float(width)
     return int(new_width * proportion)
     could not be ascertained.  Failure usually means the file does not exist
     or is not in a format recognized by PIL.
-    Depends on the Python Imaging Library (
-    See ``get_dimensions()`` if your application is not otherwise using PIL.
+    Depends on the `Python Imaging Library
+    <>`_. See ``get_dimensions()`` if your
+    application is not otherwise using PIL.
     import Image
     or is not in a recognized format.  Only JPG/PNG/GIF/BMP are supported at
     this time.
-    The algorithms are based on a PyCode recipe by Perenzo/Welch/Ray.
-    (
+    The algorithms are based on a `PyCode recipe
+    <>`_ by
+    Perenzo/Welch/Ray.
     This helper recognizes fewer image formats and is potentially less
     accurate than ``get_dimensions_pil()``.

File webhelpers/

         """Loads a default mapping of extensions and mimetypes
         These are suitable for most web applications by default. 
-        Additional types can be added with the using the mimetypes
-        module.
+        Additional types can be added by using the mimetypes module.
     init = classmethod(init)
     def add_alias(cls, alias, mimetype):
-        """Creates a MIMEType alias to a full mimetype
-        These aliases may not include /'s. Examples include 
-        html->text/html, xml->application/xml."""
+        """Create a MIMEType alias to a full mimetype.
+        Examples: ``('html', 'text/html')``, ``('xml', 'application/xml')``.
+        An ``alias`` may not contain a ``/`` character.
+        """
         if '/' in alias:
             raise ValueError("MIMEType aliases may not contain '/'")
         cls.aliases[alias] = mimetype
         type is set as well.
         This works best with URLs that end in extensions that differentiate
-        content-type. Examples:, 
+        content-type. Examples: ````, 
+        ````, ````
         Since browsers generally allow for any content-type, but should be
         sent HTML when possible, the html mimetype check should always come