Commit graph

91 commits

Author SHA1 Message Date
Matthew Dapena-Tretter
78a1ccaf2f Only include fetched fields in initial hash of sources
Should avoid unnecessary queries, as detailed in GH-295.
2014-09-26 22:33:16 -04:00
Baptiste Mispelon
3799f3c2f4 Fixed #266 -- Simplified (and renamed) StrategyWrapper.
StrategyWrapper was unnecessarily implemented as a LazyObject
and it triggered a bug in Django (issue 21840).

Changing the lazy object to a function works just as well and
bypasses the bug.
2014-01-21 17:46:19 +01:00
Matthew Tretter
14939faef6 Don't mutate __dict__ 2013-07-13 17:13:58 -04:00
Matthew Tretter
3c04cb852f Don't require source in __setstate__; fixes #234 2013-07-13 17:12:55 -04:00
Bryan Veloso
02cd1bf7ff I, for one, welcome our new @matthewwithanm overlords. 2013-06-03 12:50:20 -07:00
Matthew Tretter
f9d91c7c4d Remove source_deleted signal
...for now. Eventually, we will want a signal that tells us when sources
are no longer used, however that isn't just limited to when they're
deleted! This new signal should also be dispatched, for example, when
a source image field is set to `None`. Since none of the built-in
strategies are currently using the source_deleted signal, I've decided
to remove it until we have a more complete solution.
2013-05-25 00:50:59 -04:00
Matthew Tretter
535e68aea6 Don't send source_saved when no source
Fixes #214 and the failing test from 404fed5
2013-05-25 00:19:14 -04:00
Matthew Tretter
397a79ba56 Combine source_created and source_changed
As discussed in #214, source_created and source_changed didn't really
have clear definitions. In truth, their names and separation betray
their origins as model receivers in earlier versions. The "source group"
abstraction helped us get away from thinking about things exclusively in
terms of models, but these remained as an artifact.
2013-05-24 23:21:30 -04:00
Matthew Tretter
4efa05099d Use pilkit's process_image utility 2013-05-09 22:02:03 -04:00
Matthew Tretter
f5b171979b Canonicalize sets and dicts before hashing 2013-04-25 02:30:37 -04:00
danxshap
13c92db760 Re-open source file on ValueError in ImageSpec.generate() 2013-04-21 16:06:13 -04:00
Matthew Tretter
6f9f99e86c Fields shouldn't cause AlreadyRegistered exceptions 2013-04-05 15:28:36 -04:00
Matthew Tretter
dafebc9a4d Don't call register without spec 2013-04-05 14:38:29 -04:00
Matthew Tretter
92a3c2688c Error when attempting to generate image w/o source 2013-02-25 22:42:47 -05:00
Matthew Tretter
b33869a9f8 Sourceless specs are falsy
Passes test added in 190153d. Related to #187
2013-02-25 22:18:33 -05:00
Matthew Tretter
b53b7c3cae Clarify ImageFieldSourceGroup docstrings 2013-02-10 16:01:50 -05:00
Matthew Tretter
df41459e65 Fix signals for abstract models
Includes a fix for undispatched signals, as well as signals being
handled twice.

A regression of #126
Related: #185
2013-02-10 15:42:10 -05:00
Sean Bell
af6ebcb469 Fixing iteration over objects for abstract models 2013-02-09 03:02:18 -05: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
218f569005 Don't assign processors, so properties will work
This way, a subclass can add a @property without a setter and not worry
about an error.
2013-02-02 19:21:32 -05:00
Matthew Tretter
e1c819e9b4 Allow default generatedfile name configuration w/namers 2013-01-31 22:37:09 -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
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
a3e9a080d4 Revert signal names 2013-01-28 21:45:58 -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
eb9089e0c8 Register cacheables as generators instead of items 2013-01-24 00:04:43 -05:00
Eric Eldredge
a8855d4c27 Change spec/source registry to generator/cacheable 2013-01-23 22:46:57 -05:00
Matthew Tretter
4737ac64c4 Specs no longer accept arbitrary kwargs
Only the source.
2013-01-23 21:35:38 -05:00
Matthew Tretter
6ff1d35fbe Remove unused import 2013-01-23 21:31:53 -05:00
Matthew Tretter
eef1e41448 Remove code that used old filename kwarg 2013-01-23 21:28:23 -05:00
Matthew Tretter
4ecfa5d35e Don't rely on source filename being relative path
Closes #180
2013-01-13 23:40:26 -05:00
Matthew Tretter
658bb22c78 Special case serialization of ImageFieldFiles
Closes #168
2013-01-08 21:52:56 -05:00
Matthew Tretter
c2dedaa2b8 Use file name; not file, which can't be pickled 2013-01-08 20:57:19 -05:00
Matthew Tretter
d80f2f26a9 "source" now refers to the file itself 2012-12-11 22:53:13 -05:00
Matthew Tretter
184c13dd4e More source_group renaming 2012-12-11 22:41:10 -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
12307c97aa Use state--not constructor args--to recreate dynamic specs
Previously, we were relying on `__init__`'s arguments to recreate specs.
Now we do it the proper way, using the dict returned by `__getstate__`
(which may or may not include those arguments).
2012-12-05 23:51:30 -05:00
Matthew Tretter
042bdcefb6 Simplify dynamic spec definitions
Use a closure instead of an attribute to store the class attrs.
2012-12-05 23:38:10 -05:00
Matthew Tretter
2a6199b804 Simplify get_hash implementation 2012-12-05 23:16:07 -05:00
Matthew Tretter
0ec6067c8d Correct pickling/unpickling of dynamic specs
Previously, __reduce__ was returning a reduction of the class, not the
instance.
2012-12-05 21:10:36 -05:00
Matthew Tretter
7f11f44c67 Special case source_file for specs
It was already special. Why hide it? Closes #173
2012-12-05 21:10:31 -05:00
Matthew Tretter
956601b5d0 Revert register.spec argument order
Since we got rid of inner Config classes, we can put the order back and
support decorators.
2012-12-05 21:09:10 -05:00
Matthew Tretter
848d7d7fa3 Add TODOs 2012-12-01 23:19:45 -05:00
Matthew Tretter
14d2193f8d Remove unused args 2012-12-01 22:23:25 -05:00
Matthew Tretter
236eea8459 Move filename generation to generator 2012-12-01 22:09:34 -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