Commit graph

620 commits

Author SHA1 Message Date
Bryan Veloso
1d80e83732 Bump the version to 3.2.1. 2014-04-04 09:26:54 -07:00
Markus Kaiserswerth
3056b3efc0 Simplified RQ cache file backed by using the job decorator 2014-04-04 14:24:21 +02:00
Matthew Dapena-Tretter
f45491bddb Merge pull request #278 from mkai/_rq_async_cleanup
Cleaned up RQ cache file backend code, added async_rq setup extra
2014-03-23 18:50:45 -04:00
Markus Kaiserswerth
c5a1be3b8e Removed unneeded django_rq import 2014-03-18 17:02:23 +01:00
Markus Kaiserswerth
85d8cb15bb Added a DeprecationWarning if Async cache file backend is used 2014-03-18 16:37:18 +01: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
Bryan Veloso
1ac1a44fc5 Bump the version to 3.2. 2014-01-01 15:17:33 -08: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
Bryan Veloso
ce9a62c02c Merge branch 'python3' of https://github.com/vstoykov/django-imagekit into vstoykov-python3
* 'python3' of https://github.com/vstoykov/django-imagekit:
  Add Venelin Stoykov to AUTHORS
  Improve logic of contributing ImageSpecFields to Models
  Use force_bytes from imagekit.lib in test_cachefiles
  Remove @vstoykov's note. Seems like the right place to me (:
  Move force_bytes into lib module
  Don't use a raw string with \u escapes
  Fix sanitizing cache key under Python 3
  Add module to sys.modules
  Test for Python 3
  Insert importer at beginning of list
  Delay Django import until needed
  Add Python 3 suport and drop support for Python 2.5

Conflicts:
	imagekit/cachefiles/__init__.py
2013-12-26 17:30:42 -08:00
Bryan Veloso
452a9c1b31 Tagging 3.1. 2013-12-20 09:18:57 -08: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
Matthew Dapena-Tretter
45f10075b6 Remove @vstoykov's note. Seems like the right place to me (: 2013-12-14 13:03:02 -05:00
Matthew Dapena-Tretter
87983c5e6d Move force_bytes into lib module 2013-12-14 13:02:21 -05:00
Matthew Dapena-Tretter
c1e16696b1 Don't use a raw string with \u escapes
Apparently, Python 3.2 doesn't process these in raw strings.
See https://mail.python.org/pipermail/python-list/2012-May/624756.html
and https://mail.python.org/pipermail/python-dev/2007-May/073042.html
2013-12-14 12:54:26 -05:00
Venelin Stoykov
fb947b1937 Fix sanitizing cache key under Python 3 2013-12-14 18:56:47 +02:00
Matthew Dapena-Tretter
43afb7c33d Fix celery backend 2013-11-28 00:39:57 -05:00
Markus Kaiserswerth
af3316278d Cache file backends: dropped the "Async" in class names 2013-11-04 13:12:02 +01:00
Markus Kaiserswerth
260c6f5a10 Added RQ-based async cache file backend 2013-10-27 13:27:21 +01:00
Bryan Veloso
d6a024ed2d Bump the version to 3.0.4. 2013-09-26 10:56:22 -07:00
nex2hex
1c26a2ea5c Add __getstate__ method to ImageCacheFile 2013-09-24 15:18:59 +04:00
Matthew Tretter
bf1b45c943 Add module to sys.modules 2013-09-01 21:56:42 -04:00
Matthew Tretter
3732b2ee09 Insert importer at beginning of list 2013-09-01 21:55:58 -04:00
Matthew Tretter
183efabca7 Delay Django import until needed 2013-09-01 21:55:37 -04:00
Venelin Stoykov
0575011529 Add Python 3 suport and drop support for Python 2.5 2013-08-19 21:27:50 +03:00
Matthew Tretter
453efac553 Merge branch 'nex2hex/develop' into develop
* nex2hex/develop:
  Update fields.py
2013-08-14 23:40:02 -04:00
Matthew Tretter
c78cbfc089 Discover image generators during lookup
Fixes GH-241
2013-08-14 23:08:40 -04:00
Sean Hayes
d647678c2e Added global boolean to prevent autodiscover() from being called more than once. 2013-08-14 22:55:28 -04:00
nex2hex
1a33c2be51 Update fields.py
Don't overwrite existing image when form saved
2013-08-13 18:52:21 +06:00
Bryan Veloso
3be774bbf6 Bump to 3.0.3. 2013-07-22 10:01:20 -07:00
Bryan Veloso
532188bd51 Merge branch 'fix-pending-state' into develop
* fix-pending-state:
  Remove PENDING state
2013-07-22 09:59:08 -07:00
Bryan Veloso
cae6677994 Bump to 3.0.2. 2013-07-17 11:44:31 -07:00
Matthew Tretter
3444626084 Remove PENDING state
Re: #227
2013-07-16 21:41:10 -04:00
Matthew Tretter
a0c7b3f274 Use == for comparison 2013-07-16 20:40:48 -04: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
Matthew Tretter
637af70921 Don't include cache in serialization of backend
Fixes #227
2013-06-20 09:17:12 -04:00
Bryan Veloso
90e9d314a6 Bump version to 3.0.1. 2013-06-11 14:08:23 -07:00
Matthew Tretter
bb7e9e5891 Fix cache backend fallback
Closes #225
Closes #226
2013-06-10 18:33:22 -04:00
Matthew Tretter
01a6c555a1 Fix LazyImageCacheFile.__repr__ and __str__
Using SimpleLazyObject also lets us clean things up a bit.

Closes #218
2013-06-04 23:35:46 -04:00
Jacob Magnusson
654867c3cf PEP 3110 compat 2013-06-04 21:42:03 -04:00
Bryan Veloso
02cd1bf7ff I, for one, welcome our new @matthewwithanm overlords. 2013-06-03 12:50:20 -07:00
Bryan Veloso
0e0240085f Bump the version number to 3.0.0. 2013-05-30 00:33:10 -07:00
Matthew Tretter
09eea6edf6 Merge pull request #222 from IlyaSemenov/develop
Fixed thumbnail template tag treating provided sizes as strings, not integers
2013-05-29 18:43:04 -07:00
Ilya Semenov
761dcd20ae Fixed thumbnail template tag treating provided sizes as strings, not integers 2013-05-25 16:45:40 +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
0d5bfe3751 Define NullHandler for Python <= 2.6
Closes #219
2013-05-20 19:19:13 -04:00
Matthew Tretter
80008aee11 Merge pull request #215 from saulshanabrook/patch-5
pass in upscale keyword to thumbnail template tag
2013-05-20 16:09:05 -07:00
Matthew Tretter
32522114db Improve default cache backend handling 2013-05-13 21:28:41 -04:00
Saul Shanabrook
6023e9216a pass in upscale keyword to thumbnail template tag 2013-05-11 09:12:29 -03:00
Matthew Tretter
34739819aa Fix None checks
Files can be falsy
2013-05-10 04:43:01 -04:00
Matthew Tretter
c89b18aa95 Split before_access into two signals
Differentiating between when the generated file content is required and
when the generated file is just required to exist gives us more
flexibility with strategies.
2013-05-10 04:39:46 -04:00
Matthew Tretter
6db082bca2 Reset content pointer 2013-05-10 03:08:43 -04:00
Matthew Tretter
906fbbd463 Reduce calls to backend
Reading from an `ImageCacheFile`, will result in accessing its `file`
attribute repeatedly which would result in the `before_access` signal
being dispatched, which in turn would result in many unnecessary calls
to the image cache backend. With this change, we don't send
`before_access` if the file has already been created.

Similarly, we don't need to try to generate the image if we know for
certain that it's already been generated (because we have a reference
to it).
2013-05-10 02:56:44 -04:00
Matthew Tretter
bc49f9cf8b Store the file after we generate it
This means reading ImageCacheFiles won't result in an additional storage
operation.
2013-05-10 02:42:28 -04:00
Matthew Tretter
06dd238993 Store cachefile strategy on file; not generator
The file can appeal to the generator for the value, but it shouldn't
require it; it just does that as a convenience.
2013-05-10 00:51:47 -04:00
Matthew Tretter
d5d5fc0550 Add cachefile backend fallback
The generator shouldn't have to implement `cachefile_backend`
2013-05-10 00:26:46 -04:00
Matthew Tretter
4efa05099d Use pilkit's process_image utility 2013-05-09 22:02:03 -04:00
Matthew Tretter
d94c4bb0a9 Merge branch 'canon-pickle' into develop 2013-04-30 20:50:29 -04:00
Matthew Tretter
f173861b53 Fix invalid char range 2013-04-30 09:32:47 -04:00
Matthew Tretter
c704db2da5 Sanitize cache keys for memcached
Closes #208
2013-04-30 09:32:47 -04:00
Matthew Tretter
f5b171979b Canonicalize sets and dicts before hashing 2013-04-25 02:30:37 -04:00
Matthew Tretter
3e019f5dac Merge pull request #204 from danxshap/close_file_fix
Re-open source file on ValueError in ImageSpec.generate()
2013-04-23 10:59:14 -07:00
Matthew Tretter
0a98eb0e79 Use DEFAULT_FILE_STORAGE by default
As raised in #203, if `IMAGEKIT_DEFAULT_FILE_STORAGE` isn't set,
`DEFAULT_FILE_STORAGE` should be used.
2013-04-22 09:05:49 -04:00
danxshap
13c92db760 Re-open source file on ValueError in ImageSpec.generate() 2013-04-21 16:06:13 -04:00
Eric Brelsford
7946fe54b5 processors in PILKit: module
Help those looking in the code find processors.
2013-04-10 14:24:02 -04:00
Matthew Tretter
261f164127 Bump version to 3.0b1 2013-04-05 16:43:26 -04:00
Matthew Tretter
c4431fe296 Don't require generator to unregister 2013-04-05 16:41:53 -04:00
Matthew Tretter
6f9f99e86c Fields shouldn't cause AlreadyRegistered exceptions 2013-04-05 15:28:36 -04: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
dafebc9a4d Don't call register without spec 2013-04-05 14:38:29 -04:00
Matthew Tretter
9891314b8e Don't error if same generator is registered 2013-04-05 12:25:02 -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
2b10e85813 Clarify "force" kwarg 2013-04-02 22:55:44 -04:00
Matthew Tretter
3ca8c53698 Also defer existance check 2013-04-02 22:37:52 -04:00
Matthew Tretter
728368abf6 Add async cachefile backend 2013-04-02 22:29:53 -04:00
Matthew Tretter
86cd23e906 Remove actions module 2013-03-15 01:06:28 -04:00
Matthew Tretter
3d6a9de9aa Add existence check timeout 2013-03-15 01:05:53 -04:00
Matthew Tretter
1e129c5b70 Convert to boolean 2013-03-15 00:49:24 -04:00
Matthew Tretter
70ff6dc788 Store state when force-generated 2013-03-15 00:30:58 -04:00
Matthew Tretter
c48c720f8a Add __nonzero__ method that will work for async 2013-03-15 00:27:23 -04:00
Matthew Tretter
fc87c0497c Add abstract cachefile backend for illustration 2013-03-15 00:20:15 -04:00
Matthew Tretter
54dda25adb Generation goes through backend; use states
We might as well account for asynchronous generation in our
CachedFileBackend.
2013-03-15 00:19:19 -04:00
Matthew Tretter
ac92b77709 Fix loopy existence check
Sometimes two wrongs do make a right I guess. But better to have two
rights.
2013-03-14 23:04:30 -04:00
Matthew Tretter
f181d30008 Rename file_exists to exists 2013-03-14 22:58:28 -04:00
Matthew Tretter
044a3625f9 Correct error message 2013-03-14 22:55:40 -04:00
Matthew Tretter
c64eee40b3 Bump version to 3.0a5 2013-02-25 22:43:37 -05:00
Matthew Tretter
92a3c2688c Error when attempting to generate image w/o source 2013-02-25 22:42:47 -05:00
Matthew Tretter
61aa1c32e7 Bump version to 3.0a4 2013-02-25 22:22:27 -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
dff0182310 Remove another old util 2013-02-12 21:40:15 -05:00
Matthew Tretter
f5a078b68f Remove old util 2013-02-12 21:40:15 -05:00
Matthew Tretter
5c944c5efb Bump version to 3.0a3 2013-02-10 16:05:21 -05:00
Matthew Tretter
b53b7c3cae Clarify ImageFieldSourceGroup docstrings 2013-02-10 16:01:50 -05:00
Matthew Tretter
90ae9e8339 Fix get_nonabstract_descendants
Previously, function was only returning the first non-abstract
descendant. (It should also return concrete descendants of concrete
descendants, which it now does.)

Also, converted to generator.
2013-02-10 15:58:22 -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