Skip to content
This repository has been archived by the owner on Jul 11, 2021. It is now read-only.

Commit

Permalink
Add Django 1.8 support, remove Django 1.6 and 1.4 support
Browse files Browse the repository at this point in the history
* Update requirements
* Remove south and its migrations
* Update tests
* Remove Django 1.4 and 1.6 references
  • Loading branch information
itbabu committed Aug 30, 2015
1 parent f3377b9 commit 77d4672
Show file tree
Hide file tree
Showing 17 changed files with 90 additions and 244 deletions.
16 changes: 3 additions & 13 deletions .travis.yml
Expand Up @@ -10,24 +10,14 @@ python:

env:
matrix:
- DJANGO=1.4 DJANGOCMS=3
- DJANGO=1.6 DJANGOCMS=3
- DJANGO=1.7 DJANGOCMS=3
- DJANGO=1.8 DJANGOCMS=3


# https://docs.djangoproject.com/en/1.7/faq/install/
matrix:
exclude:
- python: 3.3
env: DJANGO=1.4 DJANGOCMS=3
- python: 3.4
env: DJANGO=1.4 DJANGOCMS=3
- python: 3.4
env: DJANGO=1.6 DJANGOCMS=3

install:
- pip install -q -r "test_requirements/django-$DJANGO.txt"
- if [[ $TRAVIS_PYTHON_VERSION == '3.3' || $TRAVIS_PYTHON_VERSION == '3.4' ]]; then pip install https://github.com/pferate/google-api-python-client/archive/python3.zip; fi
- if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then pip install google-api-python-client==1.3.1; fi


script:
- coverage run ./runtests.py
Expand Down
4 changes: 2 additions & 2 deletions cmsplugin_googleplus/googleplus.py
Expand Up @@ -3,8 +3,8 @@

from django.conf import settings

from apiclient.discovery import build
from apiclient.errors import HttpError
from googleapiclient.discovery import build
from googleapiclient.errors import HttpError

logger = logging.getLogger(__name__)

Expand Down
66 changes: 0 additions & 66 deletions cmsplugin_googleplus/south_migrations/0001_initial.py

This file was deleted.

52 changes: 0 additions & 52 deletions cmsplugin_googleplus/south_migrations/0002_rename_tables.py

This file was deleted.

Empty file.
5 changes: 3 additions & 2 deletions cmsplugin_googleplus/tests/base.py
Expand Up @@ -3,6 +3,7 @@
import json

from django.test import TestCase
from googleapiclient.http import HttpMock
from mock import patch, Mock


Expand All @@ -23,7 +24,7 @@ def data_from_file(filename):
class BaseGooglePlusTestCase(TestCase):
def setUp(self):
super(BaseGooglePlusTestCase, self).setUp()
#TODO: improve this. apiclient.http.HttpMock should be used as argument in apiclient.http.HttpRequest.execute.
# TODO: improve this. apiclient.http.HttpMock should be used as argument in apiclient.http.HttpRequest.execute.
mock = Mock()
mock.configure_mock(**{
"activities.return_value.list.return_value.execute.return_value": data_from_file('activities.json'),
Expand All @@ -34,4 +35,4 @@ def setUp(self):
self.google_plus_api = GooglePlusAPI(TEST_DEVELOPER_KEY)

def tearDown(self):
self.patcher.stop()
self.patcher.stop()
8 changes: 4 additions & 4 deletions cmsplugin_googleplus/tests/test_googleplus.py
Expand Up @@ -4,7 +4,7 @@
from django.test.utils import override_settings
from django.test import TestCase
from mock import patch, Mock
from apiclient.errors import HttpError
from googleapiclient.errors import HttpError

from .base import TEST_DEVELOPER_KEY, BaseGooglePlusTestCase
from ..googleplus import GooglePlusAPI
Expand Down Expand Up @@ -37,9 +37,9 @@ def test_search_activity_list_fetching(self):

class GooglePlusAPITestCaseWithErrors(TestCase):

error_content = '{\n "error": {\n "errors": [\n {\n "domain": "usageLimits",\n' \
'"reason": "keyInvalid",\n "message": "Bad Request"\n }\n ],\n' \
'"code": 400,\n "message": "Bad Request"\n }\n}\n'
error_content = b'{\n "error": {\n "errors": [\n {\n "domain": "usageLimits",\n' \
b'"reason": "keyInvalid",\n "message": "Bad Request"\n }\n ],\n' \
b'"code": 400,\n "message": "Bad Request"\n }\n}\n'
error_resp_dict = {'status': '400', 'x-xss-protection': '1; mode=block', 'x-content-type-options': 'nosniff',
'transfer-encoding': 'chunked', 'expires': 'Sun, 18 Aug 2013 07:25:24 GMT', 'server': 'GSE',
'cache-control': 'private, max-age=0', 'date': 'Sun, 18 Aug 2013 07:25:24 GMT',
Expand Down
8 changes: 4 additions & 4 deletions docs/source/install.rst
Expand Up @@ -6,10 +6,10 @@ This package supports Python 2.7, Python 3.3 and Python 3.4
1. Install these packages and their requirements:


* `Django>=1.4 <https://pypi.python.org/pypi/Django>`_
* `django-cms>=3.0.12 <https://pypi.python.org/pypi/django-cms>`_
* `google-api-python-client - 1.4.0 <https://pypi.python.org/pypi/google-api-python-client>`_
* `python-dateutil - 2.3 <https://pypi.python.org/pypi/python-dateutil>`_
* `Django>=1.7 <https://pypi.python.org/pypi/Django>`_
* `django-cms>=3.1.2 <https://pypi.python.org/pypi/django-cms>`_
* `google-api-python-client - 1.4.1 <https://pypi.python.org/pypi/google-api-python-client>`_
* `python-dateutil - 2.4.2 <https://pypi.python.org/pypi/python-dateutil>`_


2. Install `cmsplugin-googleplus <https://github.com/itbabu/cmsplugin-googleplus>`_ in your environment.
23 changes: 0 additions & 23 deletions docs/source/run.rst
@@ -1,30 +1,7 @@
Run
===

Django 1.7
----------

::

python manage.py migrate

Django 1.4 and Django 1.6
-------------------------

Fresh install
^^^^^^^^^^^^^
::

python manage.py syncdb --all
python manage.py migrate --fake

The first command will prompt you to create a super user. Choose ‘yes’ and enter appropriate values.

Upgrade
^^^^^^^
::

python manage.py syncdb
python manage.py migrate


70 changes: 34 additions & 36 deletions runtests.py
Expand Up @@ -5,6 +5,17 @@
import django
from django.conf import settings

TEMPLATE_CONTEXT_PROCESSORS = [
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
'cms.context_processors.cms_settings',
'sekizai.context_processors.sekizai',
]


def configure():
if not settings.configured:
Expand Down Expand Up @@ -33,25 +44,12 @@ def configure():
'django.contrib.staticfiles',
'django.contrib.humanize',
'cms',
'mptt',
'treebeard',
'menus',
'sekizai',
'djangocms_admin_style',
'django.contrib.admin',
'cmsplugin_googleplus'],
'TEMPLATE_CONTEXT_PROCESSORS': (
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django.core.context_processors.i18n',
'django.core.context_processors.request',
'django.core.context_processors.media',
'django.core.context_processors.static',
'cms.context_processors.cms_settings',
'sekizai.context_processors.sekizai',
),
'TEMPLATE_DIRS': (
location('templates'),
),
'ROOT_URLCONF': 'cmsplugin_googleplus.tests.example_project.urls',

'MIDDLEWARE_CLASSES': (
Expand All @@ -60,10 +58,9 @@ def configure():
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.doc.XViewMiddleware',
'django.middleware.common.CommonMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.user.CurrentUserMiddleware',
'cms.middleware.page.CurrentPageMiddleware',
'cms.middleware.toolbar.ToolbarMiddleware',
'cms.middleware.language.LanguageCookieMiddleware',
),
Expand All @@ -74,34 +71,35 @@ def configure():
'APPEND_SLASH': True,
'CMS_TEMPLATES': (('nav_playground.html', 'Test Template'),)
}
if django.VERSION < (1, 7, 0):
test_settings['INSTALLED_APPS'].append('south')
if django.VERSION < (1, 8, 0):
test_settings['TEMPLATE_CONTEXT_PROCESSORS'] = TEMPLATE_CONTEXT_PROCESSORS
test_settings['TEMPLATE_DIRS'] = [location('templates'), ]
else:
test_settings['MIGRATION_MODULES'] = {
'cms': 'cms.migrations_django',
'menus': 'menus.migrations_django'}
test_settings['TEMPLATES'] = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
location('templates'),
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': TEMPLATE_CONTEXT_PROCESSORS,
'debug': True
},
},
]
settings.configure(**test_settings)


def run_tests(*test_args):
if not test_args:
test_args = ['cmsplugin_googleplus']

if django.VERSION >= (1, 7, 0):
# see: https://docs.djangoproject.com/en/dev/releases/1.7/#standalone-scripts
django.setup()
from django.core.management import call_command
call_command("makemigrations", "cmsplugin_googleplus", database='default')
call_command("migrate", database='default')
else:
from south.management.commands import syncdb, migrate
if migrate:
syncdb.Command().handle_noargs(interactive=False, verbosity=1, database='default')
migrate.Command().handle(interactive=False, verbosity=1)
else:
syncdb.Command().handle_noargs(
interactive=False, verbosity=1, database='default', migrate=False, migrate_all=True)
migrate.Command().handle(interactive=False, verbosity=1, fake=True)
# see: https://docs.djangoproject.com/en/dev/releases/1.7/#standalone-scripts
django.setup()
from django.core.management import call_command
call_command("makemigrations", "cmsplugin_googleplus", database='default')
call_command("migrate", database='default')

from django_nose import NoseTestSuiteRunner
failures = NoseTestSuiteRunner().run_tests(test_args)
Expand Down
12 changes: 6 additions & 6 deletions setup.py
Expand Up @@ -8,7 +8,7 @@

setup(
name='cmsplugin-googleplus',
version='0.5.2',
version='0.6.0-dev',
include_package_data=True,
license='MIT License',
description='Django-CMS plugin for Google Plus Activities',
Expand All @@ -31,12 +31,12 @@
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
],
install_requires=[
'google-api-python-client>=1.4.0',
'python-dateutil>=2.4.1'
'google-api-python-client>=1.4.1',
'python-dateutil>=2.4.2'
],
tests_require=[
'mock>=1.0.1',
'django-nose>=1.3'
'mock>=1.3.0',
'django-nose>=1.4.1'
],
packages=find_packages()
)
)

0 comments on commit 77d4672

Please sign in to comment.