Commit graph

103 commits

Author SHA1 Message Date
Tim Gates
9d450a78b8
docs: Fix simple typo, assigment -> assignment
There is a small typo in tests/test_generateimage_tag.py, tests/test_thumbnail_tag.py.

Should read `assignment` rather than `assigment`.
2020-03-08 13:04:21 +11:00
Venelin Stoykov
60f35b0af5 Pass features to BeautifulSoup constructor
This will remove a warning durring tests
2018-10-12 23:08:20 +03:00
Venelin Stoykov
6f7de35f79
Merge pull request #469 from matthewwithanm/fix-image-cachefile-serializtion
Fix pickle serialization for ImageCacheFile
2018-06-03 18:21:48 +03:00
Roman Gorbil
de991d4048 Fix pickle serialization for ImageCacheFile
When Celery CachedFileBackend used with filesystem storage (django.core.files.storage.FileSystemStorage), everything works fine.
But there are issues with storages.backends.s3boto3.S3Boto3Storage (and it's fix from #391), as well as with django_s3_storage.storage.S3Storage.

Exception was:

```
Traceback (most recent call last):
  ...

  File "/src/django-imagekit/imagekit/cachefiles/__init__.py", line 131, in __bool__
    existence_required.send(sender=self, file=self)
  ...
  File "/libs/utils.py", line 380, in on_existence_required
    file.generate()
  File "/src/django-imagekit/imagekit/cachefiles/__init__.py", line 94, in generate
    self.cachefile_backend.generate(self, force)
  File "/src/django-imagekit/imagekit/cachefiles/backends.py", line 136, in generate
    self.schedule_generation(file, force=force)
  File "/src/django-imagekit/imagekit/cachefiles/backends.py", line 165, in schedule_generation
    _celery_task.delay(self, file.generator, force=force)
  ...
  File "/lib/python3.6/site-packages/kombu/serialization.py", line 221, in dumps
    payload = encoder(data)
  File "/lib/python3.6/site-packages/kombu/serialization.py", line 350, in pickle_dumps
    return dumper(obj, protocol=pickle_protocol)
kombu.exceptions.EncodeError: can't pickle _thread._local objects
```
2018-06-03 18:06:57 +03:00
Venelin Stoykov
6319891697
Merge pull request #440 from matthewwithanm/fix/open-files-leak
Fixed #429 Do not leak open files after generation
2017-11-20 10:02:01 +02:00
Venelin Stoykov
6ee931398f Do not leak open files after generation 2017-11-17 18:37:54 +02:00
Roman Gorbil
d80f426d3c Fix ImageCacheFile.__repr__ to not send signals
Cachefile strategy may be configured to generate file when file existance required.

To generate images, async backends passes `ImageCacheFile` instance to worker.
Both celery and RQ calls `__repr__` method for each argument to enque call.
And if `__repr__` of object will send `existnace_required` signal, we will get endless recursion.

Issue: #434
2017-10-10 17:39:46 +07:00
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
d86ec082f1 Fixed #350: Error when trying to access width/height after url
If the file is closed and something is calling `open` now the file will be opened correctly event if it was already closed
2016-07-17 05:08:01 +03:00
Venelin Stoykov
07d29b3bf7 Fixes #382: Tests no longer leave junk 2016-07-17 04:54:03 +03:00
Venelin Stoykov
5cde74e3e2 Fixes #379 Support for Django 1.10 2016-07-11 01:59:32 +03:00
Michael Fladischer
4e370fdc59 Replace Lenna image in tests with a truly free alternative.
The Lenna image used in image processing tests is considered problematic due to
its unclear copyright status. Right now it is considered to be "overlooked" by
the copyright holder Playboy.

A suitable replacement image is already provided in the libav sources which is
licensed under the Expat (MIT) license and thus truly free.

This replaces the Lenna image with the one from the libav project.
2016-02-09 11:43:05 +01:00
Venelin Stoykov
458f80050c Do not use progressive when we are not running in terminal 2015-06-05 03:01:07 +03:00
Venelin Stoykov
e455768352 Add test environments for Python3.4 and Django1.7 and Django1.8 2015-06-05 03:01:00 +03:00
Matthew Dapena-Tretter
e2ae850866 Revert "Remove test dir __init__.py"
This reverts commit f5b23a67bd.

I forgot we were using 'tests.settings' as a settings module path.
2014-09-27 17:52:21 -04:00
Matthew Dapena-Tretter
8d35dad5fc Add test to illustrate GH-295 2014-09-26 21:32:01 -04:00
Matthew Dapena-Tretter
bbf48a7953 Test that there isn't IO done when you get a URL 2014-09-23 18:41:09 -04:00
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
Matthew Dapena-Tretter
c92f53c1b0 Test that Optimistic strategy doesn't cause reads
Using the Optimistic strategy should prevent IO ops when you cast the
file as a boolean.
2014-09-23 18:40:58 -04:00
Matthew Dapena-Tretter
f5b23a67bd Remove test dir __init__.py
Related: matthewwithanm/pilkit#14
2014-09-23 14:59:20 -04: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
Venelin Stoykov
8a600d30b3 Use force_bytes from imagekit.lib in test_cachefiles 2013-12-15 01:58:22 +02:00
Venelin Stoykov
fb947b1937 Fix sanitizing cache key under Python 3 2013-12-14 18:56:47 +02:00
nex2hex
1c26a2ea5c Add __getstate__ method to ImageCacheFile 2013-09-24 15:18:59 +04:00
Matthew Tretter
3444626084 Remove PENDING state
Re: #227
2013-07-16 21:41:10 -04:00
Matthew Tretter
db6cfcb6ce Add (failing) test for #234 2013-07-13 16:38:49 -04:00
Matthew Tretter
3001069254 Test stringification of LazyImageCacheFiles 2013-06-04 23:35:46 -04:00
Jacob Magnusson
6582794408 Remove unused imports 2013-06-04 21:41:52 -04:00
Bryan Veloso
02cd1bf7ff I, for one, welcome our new @matthewwithanm overlords. 2013-06-03 12:50:20 -07:00
Matthew Tretter
404fed58ec Add failing test for source_save signal w/o source
This is like the test contributed by @saulshanabrook in #214, but
catches the bug closer to its source. (A more unit-y unit test.)
2013-05-25 00:07:58 -04:00
Matthew Tretter
c6a0a13c45 Test that source_saved is dispatched for new instance 2013-05-25 00:04:26 -04:00
Matthew Tretter
a6ef72027b Make test less verbose 2013-05-25 00:04:26 -04:00
Matthew Tretter
4ff55724dc Separate source group tests; signal counting util 2013-05-25 00:04:22 -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
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
eb36ae399e Add test for memcached key sanitation 2013-04-30 09:32:47 -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
fbf052ce5f Fix test: update DummyAsyncCacheFileBackend API 2013-04-02 23:00:54 -04:00
Matthew Tretter
b061e135c2 Add tests for cachefile truthiness 2013-03-15 00:49:44 -04:00
Matthew Tretter
aae6aeb142 Add truthy/falsy file assertion utils 2013-03-14 22:24:33 -04:00
Matthew Tretter
d62d8a824e Rename test_specs 2013-03-14 22:17:37 -04:00
Matthew Tretter
14be033b7f Add SECRET_KEY for tests 2013-03-13 23:41:28 -04:00
Matthew Tretter
92a3c2688c Error when attempting to generate image w/o source 2013-02-25 22:42:47 -05:00
Matthew Tretter
190153d068 Add test to ensure sourceless specs are falsy
Currently failing; related to #187
2013-02-25 22:15:57 -05:00
Matthew Tretter
e456e0fd99 Remove util tests
These are part of PILKit
2013-02-12 21:40:15 -05:00
Matthew Tretter
7bf3e4e7a3 Add test for @seanbell's utility
Currently failing
2013-02-10 15:54:40 -05:00
Matthew Tretter
de550b71df Add test for abstract model signals 2013-02-10 15:42:39 -05:00
Matthew Tretter
ec5d4ed324 Remove processor tests; these are in PILKit 2013-02-07 23:15:08 -05:00
Matthew Tretter
561856abd7 Don't use assert_not_in
It's not available in Python 2.6
2013-02-06 22:04:13 -05:00
Matthew Tretter
50d83745bc Remove unnecessary complexity of kwarg mapping 2013-02-01 01:02:20 -05:00