Anonymous avatar Anonymous committed 3c337d7

Docs update, distutils fix

Comments (0)

Files changed (6)

 ._*
 .git*
 docs/_build
+dist
+MANIFEST
+include LICENSE
+include MANIFEST.in
+include README
+include docs/_static
+include docs/_templates
+include docs/conf.py
+include docs/index.rst
+include docs/make.bat
+include docs/Makefile
+recursive-include sorl *
+sorl-thumbnail is a simple to use thumbnailing application for Django.
+
+All documentation is in the "docs" directory and online at
+http://thumbnail.sorl.net/docs/
 string/unicode object containing the relative path to a file.
 
 
-``size`` can either be:
+*size* can either be:
 
 * the size in the format ``[width]x[height]`` (for example,
   ``{% thumbnail source 100x50 %}``) or
 
 *Note to sorl-thumbnail
 vetarans: The older format of comma separated options is still supported
-(with the limitation that ``quality`` is the only option to which you can pass
+(with the limitation that *quality* is the only option to which you can pass
 an argument to).*
 
 Unless you change the :ref:`thumbnail-processors`, valid options are:
 
-**crop**
+crop
     Crop the source image height or width to exactly match the requested
     thumbnail size (the default is to proportionally resize the source image
     to fit within the requested thumbnail size).
 
-**max**
-    Will resize the image to the same size as the ``crop`` option but it
+max
+    Will resize the image to the same size as the *crop* option but it
     does not crop.
 
-**autocrop**
+autocrop
     Remove any unnecessary whitespace from the edges of the source image.
     This occurs before the crop or propotional resize.
 
-**bw**
+bw
     Make the thumbnail grayscale (not really just black & white).
 
-**upscale**
+upscale
     Allow upscaling of the source image during scaling.
 
-**sharpen**
+sharpen
     Sharpen the thumbnail image (using the PIL sharpen filter)
 
-**detail**
-    Add detail to the image, like a mild ``sharpen`` (using the PIL detail
+detail
+    Add detail to the image, like a mild *sharpen* (using the PIL detail
     filter)
 
-One further special option is also available to the template tag:
-
-**quality=[1-100]**
+quality=[1-100]
     Alter the quality of the JPEG thumbnail (the default is 85).
 
 An example of basic usage::
 
 DjangoThumbnail class
 ---------------------
-The thumbnail tag can also place a 'DjangoThumbnail' object in the context,
+The thumbnail tag can also place a ``DjangoThumbnail`` object in the context,
 providing access to the properties of the thumbnail such as the height and
 width::
 
     {% thumbnail [source] [size] [options] as [variable] %}
 
-When ``as [variable]`` is used, the tag does not return the absolute url of the
-thumbnail. The variable (containing the 'DjangoThumbnail' object) has the
+When *"as [variable]"* is used, the tag does not return the absolute url of the
+thumbnail. The variable (containing the ``DjangoThumbnail`` object) has the
 following useful methods and properties:
 
-**absolute_url**
-    The absolute url of the thumbnail (the ``__unicode__`` method of this
+absolute_url
+    The absolute url of the thumbnail (the *__unicode__* method of this
     object also returns the absolute url, so you can also just do
     ``{{ thumbnail_variable }}`` in your template).
 
-**relative_url**
+relative_url
     The relative url (to ``MEDIA_URL``) of the thumbnail.
 
-**width and height**
+width and height
     The width/height of the thumbnail image.
 
-**filesize**
+filesize
     The file size (in bytes) of the thumbnail.
     To output user-friendly file sizes, use the included :ref:`filesize-filter`
-    (or Django's built-in more simplistic 'filesizeformat' filter).
+    (or Django's built-in more simplistic *filesizeformat* filter).
 
-**source_width** and **source_height**
+source_width and source_height
     The width/height of the source image.
 
-**source_filesize**
-    The file size of the source. Has same methods as ``filesize``.
+source_filesize
+    The file size of the source. Has same methods as *filesize*.
 
 
 An example of advanced usage::
 ---------------------------
 
 By default, if there is an error creating the thumbnail or resolving the image
-variable (1st argument) then the thumbnail tag will just return an empty string.
-And if there was a context variable to be set it will also be set to an empty
-string. For example, you will not see an error if the thumbnail could not be written
-to directory because of permissions error. To display those errors rather than failing silently, add a ``THUMBNAIL_DEBUG``
-property to your settings module and set it to ``True``::
+variable (1st argument) then the thumbnail tag will just return an empty
+string. And if there was a context variable to be set it will also be set to an
+empty string. For example, you will not see an error if the thumbnail could not
+be written to directory because of permissions error. To display those errors
+rather than failing silently, add a ``THUMBNAIL_DEBUG`` property to your
+settings module and set it to ``True``::
 
 	THUMBNAIL_DEBUG = True
 
 thumbnail. Note that the order of the processors is the order in which they
 are called to process the image. Each processor is passed the requested size
 and a dictionary containing all options which the thumbnail was called with
-(except for ``quality``, because that's just used internally for saving).
+(except for *quality*, because that's just used internally for saving).
 
 For example, to add your own processor to the list of possible, you would
 create a processor like this::
 Default processors
 ------------------
 
-**colorspace**
+colorspace
     This processor is best kept at the top of the list since it will convert
     the image to RGB color space needed by most of following processors. It is
-    also responsible for converting an image to grayscale if ``bw`` option is
+    also responsible for converting an image to grayscale if *bw* option is
     specified.
 
-**autocrop**
+autocrop
     This will crop the image of white edges and is still pretty experimental.
 
-**scale_and_crop**
+scale_and_crop
     This will correctly scale and crop your image as indicated.
 
-**filters**
-    This provides the ``sharpen`` and ``detail`` options described in the
+filters
+    This provides the *sharpen* and *detail* options described in the
     options section
 
 Writing a custom processor
 ThumbnailField
 --------------
 
-A new ``size`` argument is required for this field.
-
-**size**
+size (required)
     A 2-length tuple used to size down the width and height of the source image.
 
-Several new optional arguments can also be used:
-
-**options**
+options
     A list of options to use when thumbnailing the source image.
 
-**quality**
+quality
     Alter the quality of the JPEG thumbnail.
 
-**basedir**, **subdir** and **prefix**
+basedir, subdir and prefix
     Used to override the default :ref:`thumbnail-filenames` settings.
 
 Here is an example model with a ``ThumbnailField``::
 ImageWithThumbnailsField
 ------------------------
 
-A new ``thumbnail`` argument is required for this field. Pass in a dictionary
-with the following values (all optional except for ``size``):
+A *thumbnail* argument is required for this field. Pass in a dictionary
+with the following values (all optional except for *size*):
 
-**size** (required)
+size
     A 2-length tuple of the thumbnail width and height.
 
-**options**
+options
     A list of options for this thumbnail.
 
-**quality**, **basedir**, **subdir** and **prefix**
-    See the options of the template tag (above) for details.
+quality, basedir, subdir and prefix
+    Used to override the default :ref:`thumbnail-filenames` settings.
 
-Your model instance's field will have a new property, ``thumbnail``, which
-returns a 'DjangoThumbnail' instance for your pleasure (if you use this in a
+Your model instance's field will have a new property, *thumbnail*, which
+returns a ``DjangoThumbnail`` instance for your pleasure (if you use this in a
 template, it'll return the full URL to the thumbnail).
 
 Let's look at an example. Here is a model with an ``ImageWithThumbnailsField``::
         photo = ImageWithThumbnailsField(upload_to='profiles',
                                          thumbnail={'size': (50, 50)})
 
-A template (passed an instance of 'MyModel') would simply use something like:
+A template (passed an instance of *MyModel*) would simply use something like:
 ``<img src="{{ my_model.photo.thumbnail }}" alt="{{ my_model.name }}" />`` or
 it could use the :ref:`simple-html-tag`.
 
 ---------------
 
 Your model instance's field (for both thumbnail field types) has a new
-``thumbnail_tag`` property which can be used to return HTML like
+*thumbnail_tag* property which can be used to return HTML like
 ``<img src="..." width="..." height="..." alt="" />``.
 
-Now, even simpler for just a basic ``img`` tag:
+Now, even simpler for just a basic *img* tag:
 ``{{ my_model.photo.thumbnail_tag }}``.
 
 Note that when the source image is deleted, any related thumbnails are also
 -------------------
 
 If you want to use multiple thumbnails for a single field, you can use the
-``extra_thumbnails`` argument, passing it a dictionary like so::
+*extra_thumbnails* argument, passing it a dictionary like so::
 
     photo = ImageWithThumbnailsField(
         upload_to='profiles',
 This is available to both thumbnail field types.
 
 Similar to how the :ref:`simple-html-tag` works, you can using the
-``extra_thumbnails_tag`` property:
+*extra_thumbnails_tag* property:
 ``my_model.photo.extra_thumbnails_tag['large']`` (or in a template,
 ``{{ my_model.photo.extra_thumbnails_tag.large }}``).
 
 
 The normal behaviour is that thumbnails are only generated when they are
 first accessed. To have them generated as soon as the source image is saved,
-you can set the field's ``generate_on_save`` attribute to ``True``.
+you can set the field's *generate_on_save* attribute to ``True``.
 
 Changing the thumbnail tag HTML
 -------------------------------
 
 If you don't like the default HTML output by the thumbnail tag shortcuts
-provided by this field, you can use the ``thumbnail_tag`` argument. For
+provided by this field, you can use the *thumbnail_tag* argument. For
 example, to use HTML4.0 compliant tags, you would do the following::
 
     photo = ImageWithThumbnailsField(
 -----------------------------------------
 
 PIL chooses which type of image to save as based on the extension so you can
-use the ``extension`` argument to save as a different image type that the
+use the *extension* argument to save as a different image type that the
 default JPEG format. For example, to make the generated thumbnail a PNG file::
 
     photo = ImageWithThumbnailsField(
 This just doesn't cover my cravings!
 ====================================
 
-1. Use the 'DjangoThumbnail' class in ``sorl.thumbnail.main`` if you want
+1. Use the ``DjangoThumbnail`` class in ``sorl.thumbnail.main`` if you want
    behaviour similar to :ref:`template-tag`. If you want to use a
    different file naming method, just subclass and override the
-   ``_get_relative_thumbnail`` method.
+   *_get_relative_thumbnail* method.
 
 2. Go for the ``Thumbnail`` class in ``sorl.thumbnail.base`` for more
    low-level creation of thumbnails. This class doesn't have any
 	Thumbnail file size: {{ thumb.filesize|filesize }}
 
 If the generated thumbnail size came to 2000 bytes, this would output
-"Thumbnail file size: 1.9 KiB" (the filter's default format is ``auto1024``).
+"Thumbnail file size: 1.9 KiB" (the filter's default format is *auto1024*).
 You can specify a different format like so::
 
 	{{ thumb.filesize|filesize:"auto1000long" }}
 
 Acceptable formats are:
 
-**auto1024**, **auto1000**
+auto1024, auto1000
     convert to the nearest unit, appending the abbreviated unit name to the
-    string (e.g. '2 KiB' or '2 kB'). ``auto1024`` is the default format.
+    string (e.g. '2 KiB' or '2 kB'). *auto1024* is the default format.
 
-**auto1024long**, **auto1000long**
+auto1024long, auto1000long
     convert to the nearest multiple of 1024 or 1000, appending the correctly
     pluralized unit name to the string (e.g. '2 kibibytes' or '2 kilobytes').
 
-**kB, MB, GB, TB, PB, EB, ZB, YB**
+kB, MB, GB, TB, PB, EB, ZB, YB
     convert to the exact unit (using multiples of 1000).
 
-**KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB**
+KiB, MiB, GiB, TiB, PiB, EiB, ZiB, YiB
     convert to the exact unit (using multiples of 1024).
 
-The ``auto1024`` and ``auto1000`` formats return a string, appending the
+The *auto1024* and *auto1000* formats return a string, appending the
 correct unit to the value. All other formats return the floating point value.
 from distutils.core import setup
  
 setup(
-    name = "sorl-thumbnail",
-    version = "3.2",
+    name = 'sorl-thumbnail',
+    version = '3.2',
+    url = 'http://code.google.com/p/sorl-thumbnail/',
+    download_url = 'http://sorl-thumbnail.googlecode.com/files/sorl-thumbnail-3.2.tar.gz',
+    description = 'Thumbnails for Django',
     packages = [
-        "sorl",
-        "sorl.thumbnail",
-        "sorl.thumbnail.templatetags",
-        "sorl.thumbnail.tests",
-        "sorl.thumbnail.management",
-        "sorl.thumbnail.management.commands",
+        'sorl',
+        'sorl.thumbnail',
+        'sorl.thumbnail.templatetags',
+        'sorl.thumbnail.tests',
+        'sorl.thumbnail.management',
+        'sorl.thumbnail.management.commands',
     ],
 )

sorl/thumbnail/bin/thumbnail_cleanup.py

-#!/usr/bin/env python
-"""
-Tries to delete thumbnails not in use.
-"""
-# This module is only being kept around for backwards compatibility, so in that
-# vein, it also imports the two original methods in case someone's code tries
-# to import them.
-from sorl.thumbnail.management.commands.thumbnail_cleanup import get_thumbnail_path, clean_up
-
-
-if __name__ == "__main__":
-    from django.core.management import call_command
-    call_command('thumbnail_cleanup')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.