diff --git a/.gitignore b/.gitignore index e8e365d..5fc7064 100644 --- a/.gitignore +++ b/.gitignore @@ -1,11 +1,11 @@ *.pyc *~ *.swp -coverage/* -build/* +*.egg-info +.tox/ +coverage*/ +build/ docs/_build MANIFEST dist/ -audio/* mydatabase - diff --git a/.travis.yml b/.travis.yml index f779d71..4f7852e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,14 @@ language: python python: - - 2.7 + - 2.6 + - 2.7 install: - - ./.travis_setup + - pip install -r requirements/dev.txt + - pip install . + - pip install Django==$DJANGO_VERSION env: - - SKIP_COVERAGE=1 SKIP_INSTALL=1 DJANGO_VERSION=1.4.5 - - SKIP_COVERAGE=1 SKIP_INSTALL=1 DJANGO_VERSION=1.3.1 + - SKIP_COVERAGE=1 SKIP_INSTALL=1 DJANGO_VERSION=1.4.10 + - SKIP_COVERAGE=1 SKIP_INSTALL=1 DJANGO_VERSION=1.3.7 script: fab test notifications: email: false diff --git a/.travis_setup b/.travis_setup deleted file mode 100755 index dfd3e2a..0000000 --- a/.travis_setup +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -pip install -i http://armstrong.github.com/pypi.armstrongcms.org/index/ -r requirements/dev.txt -pip install . -pip install Django==$DJANGO_VERSION diff --git a/README.rst b/README.rst index f09a8f4..e64d7c9 100644 --- a/README.rst +++ b/README.rst @@ -11,45 +11,52 @@ foundation that the rest of the Armstrong content types are built off of. For more information, please see the `full documentation`_. .. change this link to point to docs inside docs.armstrongcms.org once its done -.. _full documentation: http://armstrong.github.com/armstrong.core.arm_content/ +.. _full documentation: http://armstrong.github.io/armstrong.core.arm_content/ + Installation & Configuration ---------------------------- -You can install the latest release of ``armstrong.core.arm_content`` using -`pip`_: +#. ``pip install armstrong.core.arm_content`` + +#. Add ``taggit`` to your ``INSTALLED_APPS`` + +*Note:* You do not need to run ``syncdb`` or ``migrate`` after installing +because this component does not have any concrete models. For the same reason, +you do not need to add this to INSTALLED_APPS. -:: +Optional Settings & Requirements: +""""""""""""""""""""""""""""""""" - pip install armstrong.core.arm_content +To use the Sorl features, like ``SorlThumbnailMixin``, you'll need two things: + #. Add ``sorl.thumbnail`` to your ``INSTALLED_APPS`` -You don't need to add ``armstrong.core.arm_content`` to your installed apps -unless you want to use the include template tags. You can add it like this: + #. Install an imaging library. Sorl supports several and you'll need one + mentioned in their `docs`_. -:: +To use the included template tags: + #. Add ``armstrong.core.arm_content`` to your ``INSTALLED_APPS`` - INSTALLED_APPS += ["armstrong.core.arm_content", ] + #. Follow the above directions to install Sorl. -Note that you do not need to run ``syncdb`` or ``migrate`` after installing -``armstrong.core.arm_content`` as it does not have any models. -.. _pip: http://www.pip-installer.org/ +.. _docs: http://sorl-thumbnail.readthedocs.org/en/latest/requirements.html#image-library State of Project ---------------- Armstrong is an open-source news platform that is freely available to any -organization. It is the result of a collaboration between the `Texas Tribune`_ -and `Bay Citizen`_, and a grant from the `John S. and James L. Knight -Foundation`_. +organization. It is the result of a collaboration between the `Texas Tribune`_ +and `The Center for Investigative Reporting`_ and a grant from the +`John S. and James L. Knight Foundation`_. To follow development, be sure to join the `Google Group`_. -``armstrong.core.arm_content`` is part of the `Armstrong`_ project. You're +``armstrong.core.arm_content`` is part of the `Armstrong`_ project. You're probably looking for that. .. _Armstrong: http://www.armstrongcms.org/ -.. _Bay Citizen: http://www.baycitizen.org/ +.. _The Center for Investigative Reporting: http://cironline.org/ .. _John S. and James L. Knight Foundation: http://www.knightfoundation.org/ .. _Texas Tribune: http://www.texastribune.org/ .. _Google Group: http://groups.google.com/group/armstrongcms @@ -57,7 +64,7 @@ probably looking for that. License ------- -Copyright 2011-2012 Bay Citizen and Texas Tribune +Copyright 2011-2014 Texas Tribune and The Center for Investigative Reporting Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/armstrong/core/arm_content/features/__init__.py b/armstrong/core/arm_content/features/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/armstrong/core/arm_content/features/images_presets.feature b/armstrong/core/arm_content/features/images_presets.feature deleted file mode 100644 index 20d7218..0000000 --- a/armstrong/core/arm_content/features/images_presets.feature +++ /dev/null @@ -1,73 +0,0 @@ -Feature: Preset image settings - In order to refer to commonly used image thumbnail settings more easily - I want to be able to use a name to refer to sets of thumbnail settings - - Scenario Outline: Fetch the URL for an image with pre-set settings - Given I have an Image that refers to - And I have the following thumbnail presets: - | name | width | height | crop | - | small | 50 | 50 | 50% | - | sidebar | 300 | | 50% | - When I ask for each preset thumbnail for the image - Then each thumbnail has the specified settings - - Examples: - | path | - | a.png | - | test.jpg | - | animated_meme.gif | - | cute-kitten.jpeg | - - - Scenario Outline: Basic defaults - Given I have an Image that refers to - And I have a default preset quality of 100 - And I have the following thumbnail presets: - | name | width | height | crop | - | small | 50 | 50 | 50% | - | sidebar | 300 | | 50% | - When I ask for each preset thumbnail for the image - Then each thumbnail has the specified settings - And each thumbnail has a quality of 100 - - Examples: - | path | - | a.png | - | test.jpg | - | animated_meme.gif | - | cute-kitten.jpeg | - - Scenario Outline: Override a default - Given I have an Image that refers to - And I have a default preset quality of 100 - And I have the following thumbnail presets: - | name | width | height | crop | quality | - | small | 50 | 50 | 50% | | - | small_low_quality | 50 | 50 | 50% | 25 | - | sidebar | 300 | | 50% | | - When I ask for each preset thumbnail for the image - Then each thumbnail has the specified settings - And the thumbnails without specified quality settings have a quality of 100 - - Examples: - | path | - | a.png | - | test.jpg | - | animated_meme.gif | - | cute-kitten.jpeg | - - Scenario Outline: Fetch the original image - Given I have an Image that refers to - And I have the following thumbnail presets: - | name | width | height | crop | - | small | 50 | 50 | 50% | - | sidebar | 300 | | 50% | - When I ask for the original thumbnail for the image - Then the returned thumbnail is the original image - - Examples: - | path | - | a.png | - | test.jpg | - | animated_meme.gif | - | cute-kitten.jpeg | diff --git a/armstrong/core/arm_content/features/images_render.feature b/armstrong/core/arm_content/features/images_render.feature deleted file mode 100644 index 7d2b2db..0000000 --- a/armstrong/core/arm_content/features/images_render.feature +++ /dev/null @@ -1,20 +0,0 @@ -Feature: Images can render themselves - In order to easily render the visual representations of various content - types from templates - I want to be able to call a method to render a thumbnail - - Scenario Outline: Render a thumbnail - Given I have an Image that refers to - And I have the following thumbnail presets: - | name | width | height | crop | - | small | 50 | 50 | 50% | - | sidebar | 300 | | 50% | - When I render its small thumbnail - Then I see an IMG tag - - Examples: - | path | - | a.png | - | test.jpg | - | animated_meme.gif | - | cute-kitten.jpeg | diff --git a/armstrong/core/arm_content/features/steps.py b/armstrong/core/arm_content/features/steps.py deleted file mode 100644 index c327019..0000000 --- a/armstrong/core/arm_content/features/steps.py +++ /dev/null @@ -1,97 +0,0 @@ -from copy import deepcopy - -from django.conf import settings -import fudge -import fudge.patcher -from lettuce import * -from sorl.thumbnail.base import ThumbnailBackend - -from armstrong.core.arm_content.images.sorl import get_preset_thumbnail, dimensions -from armstrong.core.arm_content.tests.arm_content_support.models import SorlImage - - -def get_thumbnail_mock(self, file_, dimensions, **kwargs): - thumbnail = deepcopy(file_) - thumbnail.storage = file_.storage # This doesn't copy over for some reason. - thumbnail._kwargs = kwargs - thumbnail._kwargs['dimensions'] = dimensions - return thumbnail - -@before.each_scenario -def initialize_world(scenario): - world.presets = None - world.defaults = None - -@step(u'Given I have an Image that refers to (.*)') -def given_i_have_an_image_that_refers_to_path(step, path): - world.image = SorlImage(image=path) - -@step(u'And I have the following thumbnail presets:') -def and_i_have_the_following_thumbnail_presets(step): - world.presets = {} - for hash in step.hashes: - name = hash.pop('name') - # Empty columns should be treated as completely omitted. - for key, value in hash.items(): - if not value: - del hash[key] - world.presets[name] = hash - -@step(u'When I ask for each preset thumbnail for the image') -@fudge.patcher.with_patched_object(ThumbnailBackend, 'get_thumbnail', get_thumbnail_mock) -def when_i_ask_for_each_preset_thumbnail_for_the_image(step): - world.thumbnails = dict( - (preset, get_preset_thumbnail(world.image.image, preset, - presets=world.presets, defaults=world.defaults)) - for preset in world.presets) - -@step(u'When I ask for the (.*) thumbnail for the image') -@fudge.patcher.with_patched_object(ThumbnailBackend, 'get_thumbnail', get_thumbnail_mock) -def when_i_ask_for_a_preset_thumbnail_for_the_image(step, preset_label): - world.thumbnail = get_preset_thumbnail(world.image.image, preset_label, - presets=world.presets, defaults=world.defaults) - -@step(u'Then the returned thumbnail is the original image') -def then_the_returned_thumbnail_is_the_original_image(step): - assert world.thumbnail.name == world.image.image.name - -@step(u'Then each thumbnail has the specified settings') -def then_each_thumbnail_has_the_specified_settings(step): - for preset_label, preset in world.presets.items(): - preset = preset.copy() - thumbnail = world.thumbnails[preset_label] - - # Use the arguments passed to sorl's get_thumbnail as an approximation of - # getting a thumbnail returned with those settings. - args = thumbnail._kwargs - assert args['dimensions'] == dimensions(preset.get('width'), preset.get('height')) - preset.pop('height', None), preset.pop('width', None) - for key, value in preset.items(): - assert args[key] == value - -@step(u'And I have a default preset quality of 100') -def and_i_have_a_default_preset_quality_of_100(step): - world.defaults = world.defaults or {} - world.defaults['quality'] = 100 - -@step(u'And each thumbnail has a quality of 100') -def and_each_thumbnail_has_a_quality_of_100(step): - for thumbnail in world.thumbnails.values(): - assert thumbnail._kwargs['quality'] == 100 - -@step(u'And the thumbnails without specified quality settings have a quality of 100') -def and_the_thumbnails_without_specified_quality_settings_have_a_quality_of_100(step): - for preset_label, preset in world.presets.items(): - thumbnail = world.thumbnails[preset_label] - if 'quality' not in preset: - assert thumbnail._kwargs['quality'] == 100 - -@step(u'When I render its (\w+) thumbnail') -@fudge.patcher.with_patched_object(ThumbnailBackend, 'get_thumbnail', get_thumbnail_mock) -def when_i_render_its_thumbnail(step, preset_label): - world.rendered = world.image.render_visual(preset_label, presets=world.presets, - defaults=world.defaults) - -@step(u'Then I see an IMG tag') -def then_i_see_an_img_tag(step): - assert world.rendered.startswith('=1.2.0,<1.3.1", "django-taggit==0.9.3", - "sorl-thumbnail==11.05.2", + "sorl-thumbnail>=11.05.2", "armstrong.core.arm_sections>=1.5.3,<2.0", "armstrong.core.arm_access>=1.0.6,<2.0", "armstrong.utils.backends>=1.0.0,<2.0" diff --git a/requirements/dev.txt b/requirements/dev.txt index 6914dea..910781a 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,4 +1,2 @@ -armstrong.apps.content -armstrong.dev>=1.12.1 --e git://github.com/tswicegood/lettuce.git@fix-port-issues#egg=lettuce --r ./sorl.txt +armstrong.dev>=1.12.1,<2.0 +south<1.0 diff --git a/requirements/sorl.txt b/requirements/sorl.txt deleted file mode 100644 index 57a3f55..0000000 --- a/requirements/sorl.txt +++ /dev/null @@ -1,2 +0,0 @@ -PIL -sorl-thumbnail diff --git a/setup.py b/setup.py index 5afdb7e..4bd3009 100644 --- a/setup.py +++ b/setup.py @@ -79,7 +79,7 @@ def build_package(dirpath, dirnames, filenames): in os.walk(info["name"].replace(".", "/"))] setup_kwargs = { - "author": "Bay Citizen & Texas Tribune", + "author": "Texas Tribune & The Center for Investigative Reporting", "author_email": "dev@armstrongcms.org", "url": "http://github.com/armstrong/%s/" % info["name"], "packages": packages,