Commit graph

65 commits

Author SHA1 Message Date
Matthew Tretter
7bc82d3624 Remove arguments from generate() method
Previously, we had two places where we were passing kwargs that affected
the image generation: the ImageSpec constructor and the generate method.
These were essentially partial applications. With this commit, there's
only one partial application (when the spec is instantiated), and the
generate method is called without arguments. Therefore, specs can now
be treated as generic generators whose constructors just happen to
accept a source_file.
2012-12-01 21:20:33 -05:00
Matthew Tretter
1f06c9ac70 Remove ImageSpecCacheFile 2012-12-01 20:41:08 -05:00
Eric Eldredge
e0567e8fa7 Remove specs.SpecRegistry; add registry module
The registry module splits the work that specs.SpecRegistry
used to do into two classes: GeneratorRegistry and
SourceGroupRegistry. These two registries are wrapped in
Register and Unregister utilities for API convenience.
2012-12-01 17:16:09 -05:00
Matthew Tretter
d253fe281a Rename image_field argument; closes #158 2012-12-01 16:46:10 -05:00
Matthew Tretter
5b1c5f7b4e Rename source objects to source groups 2012-12-01 15:51:28 -05:00
Matthew Tretter
aaa823afd6 Add flake8 linting 2012-11-05 23:34:32 -05:00
Matthew Tretter
adf143edc5 add_source -> add_sources; switch argument order 2012-10-24 22:30:10 -04:00
Matthew Tretter
12493b3a0d Spec host must support kwarg "hints"
The registry's `get_spec()` was already supporting kwargs as a means to
provide information about the source to the spec constructor/factory
function, but the ``SpecHost`` class wasn't capable of accepting any.
This commit rectifies that. The main goal purpose of this is to allow a
bound field (the file attached by ``ImageSpecFileDescriptor``)--and the
attached model instance--to be taken into account during the spec
instance creation.

Related: #156
2012-10-20 23:29:07 -04:00
Matthew Tretter
5c6d1aef5d Rename ImageSpecFile
You can generate other "spec" files (using apply will get you one). This
one is for saving cache files and its name should reflect that.
2012-10-16 23:51:26 -04:00
Matthew Tretter
df8905f7e4 Remove unused imports 2012-10-16 23:39:10 -04:00
Matthew Tretter
738bbfa9a1 Move cache file naming into ImageSpecFile 2012-10-16 23:38:44 -04:00
Matthew Tretter
5ca8b7f4ba Rename process_file; don't return image object
This function will just be used to apply the spec and create a new file;
useful for transforming images in views, etc.
2012-10-16 22:59:40 -04:00
Matthew Tretter
1452f04cda Remove unused parameter 2012-10-16 22:03:50 -04:00
Eric Eldredge
c0b79a227d Remove ImageSpecFieldFile in favor of ImageSpecFile 2012-10-15 23:53:05 -04:00
Eric Eldredge
461fbaef1a Processors no longer callable 2012-10-14 18:48:17 -04:00
Matthew Tretter
8a35b3a3dd Registration and connection of sources 2012-10-12 23:08:26 -04:00
Matthew Tretter
fe803f8981 Beginning to move functionality into "sources"
Before this is applied, we're going to have to make it so that the
image cache strategies are passed the source file, not the other file.
2012-10-10 00:18:54 -04:00
Matthew Tretter
06e5f45904 Remove unused imports 2012-10-04 23:43:02 -04:00
Matthew Tretter
436a73dc9a Remove image cache backend field registration 2012-10-04 23:28:55 -04:00
Matthew Tretter
ce08448207 Rename register_spec() to set_spec_id() 2012-10-04 23:22:25 -04:00
Matthew Tretter
56c66f4883 Back ProcessedImageField with spec registry 2012-10-04 23:15:16 -04:00
Matthew Tretter
82d0e4be73 Remove unused imports 2012-10-04 23:03:22 -04:00
Matthew Tretter
f289ff3199 Back ImageSpecFields with spec registry
This marks a major step towards centralizing some of the "spec" logic
and creating a single access point for them. Because `ImageSpecFields`
are just alternative interfaces for defining and registering specs,
they can be accessed and overridden in the same manner as other specs
(like those used by template tags): via the spec registry.
2012-10-04 22:56:26 -04:00
Matthew Tretter
0cc7938400 Re-integrate receivers module
Somewhere along the line, a change got merged that stopped using the
receivers module. This re-integrates it and moves changes made to the
old receivers (static methods on ImageSpecField) to them.
2012-10-04 21:44:55 -04:00
Matthew Tretter
d2087aa168 Create ImageSpecs; remove generators 2012-10-04 21:37:20 -04:00
Eric Eldredge
2e5489eb56 Merge branch 'ik-next' into templatetags
Conflicts:
	imagekit/models/fields/__init__.py
	imagekit/utils.py
2012-10-04 15:46:50 -04:00
Matthew Tretter
ba9bf1f877 Add image cache strategies
This new feature gives the user more control over *when* their images
are validated. Image cache backends are now exclusively for controlling
the *how*. This means you won't have to write a lot of code when you
just want to change one or the other.
2012-10-03 22:23:11 -04:00
Matthew Tretter
8a2738ca8a Add backend for caching image state 2012-09-06 22:11:23 -04:00
Matthew Tretter
2ad3791d9d Reorganize image cache backends 2012-09-06 09:11:18 -04:00
Matthew Tretter
197dfb3485 Add VALIDATE_ON_ACCESS setting 2012-09-06 09:08:45 -04:00
Eric Eldredge
bdecf75e0a Merge branch 'ik-next' into templatetags 2012-09-05 21:47:39 -04:00
Matthew Tretter
c8733c4707 Change how signals are used
Signals are now connected without specifying the class and non-IK
models are filtered out in the receivers. This is necessary because of
a bug with how Django handles abstract models.

Closes #126
2012-07-25 23:04:21 -04:00
Matthew Tretter
7ad5cf4db5 Use hashes for generated image filenames
While this change means users can no longer specify their own filenames,
changing a property of a processor, for example, will now result in a
new image. This solves a lot of the previous invalidation issues.
2012-07-19 23:48:28 -04:00
Matthew Tretter
a196e00059 Use django-appconf 2012-07-19 21:03:15 -04:00
Matthew Tretter
becee54c03 Fix pickling of ImageSpecFieldFile
Code now passes the test added in 118f6e4. Hopefully this will
address #97.
2012-07-18 22:25:26 -04:00
German M. Bravo
784afcc95d Simplified path join for the cache 2012-05-12 15:39:12 -04:00
Matthew Tretter
af7c12cb68 Tell people to import fields from the models module 2012-04-20 21:43:59 -04:00
Matthew Tretter
667e265c94 Refactored AutoConvert into prepare_image
Because of its need to return kwargs for ``Image.save()``, it never
really fit the mold of a processor.
2012-04-20 21:37:43 -04:00
Matthew Tretter
8044b97a33 Extract suggest_extension util from generator 2012-04-19 21:33:52 -04:00
Matthew Tretter
6e4a8d1b58 Woah, globals 2012-04-09 21:27:09 -04:00
Matthew Tretter
3a5d7da0d8 Validate the image any time the file is required
This means that accessing `path` or `size` will also validate,
closing #109
2012-02-23 17:46:57 -05:00
Matthew Tretter
b016065807 Fix inheritance of ImageKitMeta objects
Fixes #100
2012-02-17 21:10:09 -05:00
Matthew Tretter
84d36791b8 Pass the pickle test; should fix #97 2012-02-17 20:07:50 -05:00
Matthew Tretter
677c52b730 Rename descriptor and file to match Django 2012-02-17 18:39:51 -05:00
Matthew Tretter
6816196da7 Use "super" 2012-02-17 18:22:05 -05:00
Eduard Iskandarov
fa244cdcc9 fix unicode error 2012-02-16 19:47:22 +06:00
Timothée Peignier
98066eea93 fix import and formatting 2012-02-14 17:34:51 +01:00
Matthew Tretter
3a3f941e2c Pull field utilities out into their own module 2012-02-13 21:47:53 -05:00
Matthew Tretter
8cdbd96a1f Add files module 2012-02-13 21:44:29 -05:00
Matthew Tretter
c2891090d1 Remove old handlers
They somehow got re-added along the way
2012-02-13 21:38:40 -05:00