Commit graph

41 commits

Author SHA1 Message Date
Matthew Dapena-Tretter
00b4388245 Support should_verify_existence on strategies
This prevents extra IO. Different defaults are used for async backends
since we can’t assume that `existence_required` resulted in existence
synchronously.
2014-09-23 18:41:09 -04: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
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
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
nex2hex
1c26a2ea5c Add __getstate__ method to ImageCacheFile 2013-09-24 15:18:59 +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
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
637af70921 Don't include cache in serialization of backend
Fixes #227
2013-06-20 09:17:12 -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
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
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
c704db2da5 Sanitize cache keys for memcached
Closes #208
2013-04-30 09:32:47 -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
b33869a9f8 Sourceless specs are falsy
Passes test added in 190153d. Related to #187
2013-02-25 22:18:33 -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