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
58e1c7f7e0
Some docs
2013-02-01 01:37:49 -05:00
Matthew Tretter
f94b7276b3
Use "imagekit" instead of "ik" for built-in generator prefix
2013-02-01 01:31:51 -05:00
Matthew Tretter
50d83745bc
Remove unnecessary complexity of kwarg mapping
2013-02-01 01:02:20 -05:00
Matthew Tretter
08ebcbcbf3
Change html attrs delimiter to --
2013-02-01 00:56:29 -05:00
Matthew Tretter
92b11f8349
Use imagegenerators module, not imagespecs
2013-02-01 00:30:15 -05:00
Matthew Tretter
0947c1403f
Organize settings
2013-01-31 22:40:54 -05:00
Matthew Tretter
933ff79ac1
Make settings consistent
2013-01-31 22:38:48 -05:00
Matthew Tretter
e1c819e9b4
Allow default generatedfile name configuration w/namers
2013-01-31 22:37:09 -05:00
Matthew Tretter
bf1685dbfb
Generalize get_class util
2013-01-31 22:01:01 -05:00
Matthew Tretter
75962976d0
Add stringify methods to LazyGeneratedImageFile
2013-01-31 19:41:54 -05:00
Matthew Tretter
d6b73b8da7
Renaming/repackaging of generated file related classes
2013-01-31 19:24:08 -05:00
Matthew Tretter
8e6abc1e65
Remove ensure_exists
...
`generate()` now plays double duty
2013-01-31 10:07:27 -05:00
Matthew Tretter
01fad6e4c6
Fix registration bug
2013-01-31 10:07:27 -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
f0dbe32f7a
Fix pickling error
2013-01-29 02:27:03 -05:00
Matthew Tretter
54ca5da15d
Improve generator id pattern matching
...
This behavior allows users to easy generate images by app, model, or
field.
2013-01-29 02:22:00 -05:00
Matthew Tretter
e0ffb246ae
Always use colon as segment separator
2013-01-29 02:17:52 -05:00
Matthew Tretter
e48817a5ec
Update warmimagecache to use new cacheable registry
2013-01-29 01:53:23 -05:00
Matthew Tretter
ca4f090e63
Fix source callbacks on strategies
2013-01-29 01:48:06 -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
5b44564318
Add LazyGeneratedImageCacheFile
2013-01-28 21:46:04 -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
Matthew Tretter
c202234e82
Fix imagekit.forms.fields.ProcessedImageField
2013-01-23 22:54:25 -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
234082e63c
Extract generate() util, to make files Django likes
2013-01-23 22:34:29 -05:00
Matthew Tretter
d52b9c8100
Add utility for extracting field info
2013-01-23 21:47:54 -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
d632fc70fa
Copy contents to NamedTemporaryFile if generated file has no name
2013-01-23 21:27:21 -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
e5b15d09bd
Remove _generateimage utility.
2013-01-09 00:28:29 -05:00
Matthew Tretter
43a1f49498
New thumbnail tag syntax! Closes #177
2013-01-09 00:25:08 -05:00
Matthew Tretter
11d511f9cc
Extract util for parsing common bits.
...
In preparation for new thumbnail and placeholder tag syntaxes (#177 and
#176 ) which share some (but not all) syntax with the generateimage tag.
2013-01-08 22:42:42 -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
faee0fa537
Correct typo
2013-01-08 20:36:17 -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
52fb4e24be
Add thumbnail templatetag
...
Finally!
2012-12-07 00:42:11 -05:00
Matthew Tretter
30e40b4916
Add TODO for unregistration
2012-12-07 00:17:35 -05:00
Matthew Tretter
c69c2d087e
Create Thumbnail spec; closes #175
2012-12-06 23:48:09 -05:00
Matthew Tretter
1fb1d83c56
Add Thumbnail processor
2012-12-06 23:22:02 -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
c45876f95c
Ignore some style errors
2012-12-05 23:16:34 -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
afc5900db6
Support decorator syntax for register.spec
2012-12-05 21:09:10 -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
a07bc49a25
Remove inner Config classes
2012-12-05 21:09:10 -05:00
Matthew Tretter
4f7ce68904
Add documentation for generateimage
2012-12-03 21:11:52 -05:00
Matthew Tretter
4f81e14f58
Re-add html attribute handling
2012-12-03 21:06:15 -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
20c900df4a
Remove unused imports
2012-12-01 21:52:23 -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
5ecb491e65
Remove unused import
2012-12-01 20:47:55 -05:00
Matthew Tretter
7ed404f096
Switch args back to old order
2012-12-01 20:45:34 -05:00
Matthew Tretter
1f06c9ac70
Remove ImageSpecCacheFile
2012-12-01 20:41:08 -05:00
Matthew Tretter
9188499965
Rework template tag for generators
2012-12-01 20:36:31 -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
54baa44900
Require spec id for form fields
...
Closes #163
2012-12-01 15:56:37 -05:00
Matthew Tretter
4ead0b3002
Add note about nested config classes
2012-12-01 15:51:40 -05:00
Matthew Tretter
5b1c5f7b4e
Rename source objects to source groups
2012-12-01 15:51:28 -05:00
Matthew Tretter
49a55d4763
Try adding __reduce__
2012-12-01 14:11:04 -05:00
Matthew Tretter
5a414a3644
Rename spec_args to spec_attrs
2012-11-06 23:50:23 -05:00
Matthew Tretter
aaa823afd6
Add flake8 linting
2012-11-05 23:34:32 -05:00
Matthew Tretter
c752eea6a0
Fix bug with black mat_color
2012-11-05 22:23:29 -05:00
Matthew Tretter
f9e2ce8649
Add TODO
2012-11-03 00:27:03 -04:00
Matthew Tretter
5494ee7fc1
Clarify relationship between BaseImageSpec and ImageSpec
2012-11-03 00:08:47 -04:00
Matthew Tretter
e56d687bb0
Name can be set explicitly on GeneratedImageCacheFile
2012-11-02 22:17:25 -04:00
Matthew Tretter
64d95768f8
Extract GeneratedImageCacheFile
...
As mentioned in #167 , we want to be forward thinking and allow for a
hypothetical spec supertype which has the same functionality as an image
spec but doesn't require a source file: a generator. To this end, I've
renamed `ImageSpec.apply()` to `ImageSpec.generate()` and extracted
a `GeneratedImageCacheFile` base class from `ImageSpecCacheFile`, which
supports the more general interface of a generator--namely, a
`generate()` method with arbitrary args and kwargs.
2012-11-02 00:33:33 -04:00
Matthew Tretter
56f8d1b8bc
Create form field class; re: #163
2012-10-25 22:46:28 -04:00
Matthew Tretter
6377f89e85
IKContentFile must have name attr
2012-10-25 22:43:10 -04:00
Matthew Tretter
570e7bd640
Simplify SpecHost creation
2012-10-25 22:31:37 -04:00
Matthew Tretter
76b9ebbab4
Omit missing kwargs so as not to override defaults
...
The default image cache strategy was being overridden, which prevented
images from being generated.
2012-10-25 22:25:18 -04:00
Matthew Tretter
006ff54fa8
Clean up version meta.
2012-10-25 20:01:26 -04:00
Matthew Tretter
fb8c411f75
Create new cache warming command
...
Replaces ikcachevalidate and ikcacheinvalidate, and uses the "sources"
abstraction. Closes #165
2012-10-24 23:41:05 -04:00
Matthew Tretter
84f3b6475b
Add files() generator. Re: #165
2012-10-24 23:41:05 -04:00
Matthew Tretter
adf143edc5
add_source -> add_sources; switch argument order
2012-10-24 22:30:10 -04:00
Matthew Tretter
bdec396180
Support inner Config class for id, sources
...
Closes #164
2012-10-24 22:23:53 -04:00
Matthew Tretter
8d3fcafcd9
Swap argument order for specs.register
...
This will allow us to put the id in the inner Meta class.
2012-10-24 22:14:45 -04:00
Matthew Tretter
d110b82347
Rename imagekit_tags to imagekit
2012-10-21 17:59:56 -04:00
Matthew Tretter
3dbb96ea40
Remove unused imports
2012-10-21 17:57:53 -04:00
Matthew Tretter
3e2c3803ff
No need to call spec; the registry does that
2012-10-20 23:44:26 -04:00
Matthew Tretter
0c4d9738c6
Add TODO
2012-10-20 23:44:13 -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
aa91a70e46
Make specs know less about source files
2012-10-20 22:53:55 -04:00
Matthew Tretter
e796b4cc61
Create ImageSpec subclasses
...
Since the `ImageSpec` constructor will be accepting keyword arg hints,
it can no longer accept the properties.
2012-10-20 22:15:25 -04:00
Matthew Tretter
b0b466618f
Separate two forms of tag; support additional html attrs
...
Closes #154
2012-10-17 23:41:34 -04:00
Matthew Tretter
770a8cebf4
Fix iteration error
2012-10-17 21:35:19 -04:00
Matthew Tretter
e300ce36a4
Use new registry name
2012-10-17 21:25:19 -04:00
Matthew Tretter
4f52e401d2
Handle null format
2012-10-17 21:24:57 -04:00
Matthew Tretter
98a6fff62d
Add DEFAULT_FILE_STORAGE Setting; Closes #153
2012-10-17 21:09:04 -04:00
Matthew Tretter
ca1db05c4e
Use named logger
2012-10-17 21:00:32 -04:00
Matthew Tretter
d8ce11e86e
Log warning when filename doesn't match expected value
2012-10-17 01:11:05 -04:00
Matthew Tretter
806ebd75b6
Don't return file from generate()
...
The file is `self`
2012-10-17 00:37:02 -04:00
Matthew Tretter
ca324b7f52
Remove unused import
2012-10-17 00:32:31 -04:00
Matthew Tretter
41fa197212
Remove save kwarg--that's what generate() does!
2012-10-17 00:31:38 -04:00
Matthew Tretter
a08edaca56
Handle storage in BaseIKFile
2012-10-17 00:29:51 -04:00
Matthew Tretter
97d47c9c6c
Remove generate_file. apply() does it all!
...
There was a lot of garbage in that method and I don't know why.
2012-10-17 00:23:38 -04:00
Matthew Tretter
77b33f757c
Correct example
2012-10-17 00:07:29 -04:00
Matthew Tretter
4c4727fa9f
Remove unused import
2012-10-17 00:07:29 -04:00
Matthew Tretter
63ad9e4421
Remove registration methods from template tag
...
The registry isn't just for template tags anymore.
2012-10-17 00:07:28 -04:00
Matthew Tretter
a93832626a
Return string from render method
...
...instead of wrapping the file with an object that has a __unicode__
method. If you want the actual file, you should use the assignment form.
2012-10-17 00:07:23 -04:00
Matthew Tretter
9b81acd10c
Don't pass removed argument
2012-10-16 23:52:31 -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
fdc08aeeb0
Don't extend ImageFieldFile
...
This file isn't just for fields anymore, so we want to get rid of all
the ORM stuff.
2012-10-16 22:52:01 -04:00
Matthew Tretter
13b59ef85e
Reorder methods
2012-10-16 22:33:17 -04:00
Matthew Tretter
a4ef8aa681
Add before_access signal
2012-10-16 22:30:36 -04:00
Matthew Tretter
3308c92a71
Remove SpecWrapper class
...
We don't need it now that we have an ImageSpec class
2012-10-16 22:23:14 -04:00
Matthew Tretter
37e0de3069
Move signals module
2012-10-16 22:10:52 -04:00
Matthew Tretter
8ef1437bea
Remove apply() method
2012-10-16 22:06:24 -04:00
Matthew Tretter
1452f04cda
Remove unused parameter
2012-10-16 22:03:50 -04:00
Matthew Tretter
7f6e97a37a
Rename Pessimistic to JustInTime
2012-10-16 21:46:23 -04:00
Matthew Tretter
ca391fbf0a
Change cache prefix
2012-10-16 21:43:17 -04:00
Matthew Tretter
80b723b510
Move IKContentFile to imagekit.files
2012-10-16 21:31:47 -04:00
Eric Eldredge
c0b79a227d
Remove ImageSpecFieldFile in favor of ImageSpecFile
2012-10-15 23:53:05 -04:00
Eric Eldredge
2a33a2ad88
Fix circular import utils > imagecache.backends
2012-10-15 21:17:58 -04:00
Eric Eldredge
93409c8f05
SpecRegistry's spec can be callable (spec factory)
2012-10-14 21:35:07 -04:00
Eric Eldredge
461fbaef1a
Processors no longer callable
2012-10-14 18:48:17 -04:00
Matthew Tretter
dc84144d6b
Pass additional info with source signal
2012-10-14 16:08:48 -04:00
Matthew Tretter
7ce05f468a
Pass attname to dispatch_signal
...
This allows any file object to be used--even those that don't have a
`field` attribute. For example, you could theoretically use one spec
field as a source for another.
2012-10-14 15:41:35 -04:00
Matthew Tretter
7447d147d4
Wire up source events to specs (and image cache strategies)
...
Also change signal names to past tense to match convention.
2012-10-13 01:16:05 -04:00
Matthew Tretter
cedd744e32
Add description of registry
2012-10-13 00:22:30 -04:00
Matthew Tretter
440fcb19ef
Correct signal relaying
2012-10-12 23:43:51 -04:00
Matthew Tretter
a59330cf2c
Add class description
2012-10-12 23:12:05 -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
667f0cc08e
Simplify IMAGEKIT_CACHE_BACKEND setting
2012-10-04 23:41:20 -04:00
Matthew Tretter
436a73dc9a
Remove image cache backend field registration
2012-10-04 23:28:55 -04:00
Matthew Tretter
5a1dd0c459
Don't require spec to be created up-front
2012-10-04 23:27:19 -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
99ba61d605
Move spec registry
2012-10-04 22:02:29 -04:00