Commits

Anonymous committed 5599ecb Merge

Merge.

Comments (0)

Files changed (5)

docs/contents.rst

File contents unchanged.
+:mod:`webhelpers.media`
+================================================
+
+.. automodule:: webhelpers.media
+
+.. currentmodule:: webhelpers.media
+
+.. autofunction:: choose_height
+.. autofunction:: get_dimensions_pil
+.. autofunction:: get_dimensions

docs/mimehelper.rst

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

webhelpers/media.py

 
 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 (http://pypi.python.org/pypi/PIL).
-    See ``get_dimensions()`` if your application is not otherwise using PIL.
+    Depends on the `Python Imaging Library
+    <http://pypi.python.org/pypi/PIL>`_. See ``get_dimensions()`` if your
+    application is not otherwise using PIL.
     """
     import Image
     try:
     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.
-    (http://www.pycode.com/modules/?id=32&tab=download)
+    The algorithms are based on a `PyCode recipe
+    <http://www.pycode.com/modules/?id=32&tab=download>`_ by
+    Perenzo/Welch/Ray.
 
     This helper recognizes fewer image formats and is potentially less
     accurate than ``get_dimensions_pil()``.

webhelpers/mimehelper.py

         """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.
         
         """
         mimetypes.init()
     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: http://example.com/example, 
-        http://example.com/example.xml, http://example.com/example.csv
+        content-type. Examples: ``http://example.com/example``, 
+        ``http://example.com/example.xml``, ``http://example.com/example.csv``
                 
         Since browsers generally allow for any content-type, but should be
         sent HTML when possible, the html mimetype check should always come