Commit graph

86 commits

Author SHA1 Message Date
Venelin Stoykov
2b04099dc4 Fixed #368 use specs directly in ProcessedImageField
Thanks to @xcono for pointing to solution to the problem
2017-05-18 23:38:32 +03:00
Venelin Stoykov
2bc6241f55 Do not try south modelinspector when not needed
Fixed #408
2017-02-21 15:19:40 +02:00
Matthew Dapena-Tretter
f113fc7517 Use signal.connect for backwards compat
The receiver decorator isn't available until Django 1.3.
2014-01-01 17:47:36 -05:00
Venelin Stoykov
26aa19eeef Improve logic of contributing ImageSpecFields to Models
- If `source` is defined then register source group immediately
- If `source` is not defined then create a signal handler and attach it to
`class_prepared` signal which will see if there is only one ImageField in
the given model.

This will fix problems coused in Python 3 about using ImageSpecField
without providing a `source`.
2013-12-16 10:48:57 +02:00
Venelin Stoykov
0575011529 Add Python 3 suport and drop support for Python 2.5 2013-08-19 21:27:50 +03:00
Bryan Veloso
02cd1bf7ff I, for one, welcome our new @matthewwithanm overlords. 2013-06-03 12:50:20 -07:00
Matthew Tretter
091b2137d0 Always call set_spec_id 2013-04-05 14:57:41 -04:00
Matthew Tretter
41ab2c0fa3 Use different name for different signature 2013-04-05 14:57:11 -04:00
Matthew Tretter
681527fa9d Remove implicit source logic from descriptor
This needs to be known earlier, when registering the source group, so
we do it in `contribute_to_class` instead.

Closes #188.
2013-04-03 00:21:04 -04:00
Matthew Tretter
969275bbc9 Rename GeneratedImageFile to ImageCacheFile 2013-02-08 18:15:00 -05:00
Matthew Tretter
301adc2087 Let's call em cachefiles
Changed my mind about 04aa72c1f9. It's
just a better description, even if different strategies can change the
behavior so it isn't really very cache-like.
2013-02-04 19:52:38 -05:00
Matthew Tretter
d6b73b8da7 Renaming/repackaging of generated file related classes 2013-01-31 19:24:08 -05:00
Matthew Tretter
04aa72c1f9 Rename cache things (it isn't cachine)
https://twitter.com/alex_gaynor/statuses/257558176965206016
2013-01-31 10:07:20 -05:00
Matthew Tretter
e0ffb246ae Always use colon as segment separator 2013-01-29 02:17:52 -05:00
Matthew Tretter
3931b552a0 Separate source groups and cacheables.
This allows a sensible specialized interface for source groups, but also
for ImageKit to interact with specs using the generalized image
generator interface.
2013-01-29 01:40:00 -05:00
Matthew Tretter
cef3a41d86 Merge branch 'ik-next' into cacheables
Conflicts:
	imagekit/management/commands/warmimagecache.py
	imagekit/registry.py
2013-01-28 21:45:37 -05:00
Eric Eldredge
a8855d4c27 Change spec/source registry to generator/cacheable 2013-01-23 22:46:57 -05:00
Matthew Tretter
84b30e990f Fix imagekit.models.fields.ProcessedImageField 2013-01-23 22:41:23 -05:00
Matthew Tretter
4737ac64c4 Specs no longer accept arbitrary kwargs
Only the source.
2013-01-23 21:35:38 -05:00
Matthew Tretter
d80f2f26a9 "source" now refers to the file itself 2012-12-11 22:53:13 -05:00
Matthew Tretter
8c80ba3b4f GeneratedImageCacheFile stores file manipulation attributes
Everything for dealing with files should be part of
GeneratedImageCacheFile--not the generator. The fact that
GeneratedImageCacheFile can get this information (storage, filename,
etc.) is a convenience so that the user only has to define one class
(the generator) to fully specify their functionality, but handling the
cache file is not part of the core responsibility of the generator.

This is also the reason for the renaming of `get_filename` and `storage`
to `cache_file_name` and `cache_file_storage`: the generator is just as
useful for those who want to generate persistent files. But the original
attribute names didn't indicate that they were used only for cache
files. The new ones do, and don't preclude the addition of other
versions that would be used by another `File` subclass for specifying
file names or storage classes.
2012-12-06 19:54:26 -05:00
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