From 72ecd32c6b891395d0df98517195e01e1239234e Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Fri, 12 Feb 2016 13:15:20 +0100 Subject: [PATCH 1/5] Use pandoc to generate a nice PyPI information page. --- requirements/requirements-packaging.txt | 3 +++ setup.py | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/requirements/requirements-packaging.txt b/requirements/requirements-packaging.txt index 8f62ee365..89819da20 100644 --- a/requirements/requirements-packaging.txt +++ b/requirements/requirements-packaging.txt @@ -6,3 +6,6 @@ twine==1.4.0 # Transifex client for managing translation resources. transifex-client==0.11 + +# Pandoc to have a nice pypi page +pypandoc diff --git a/setup.py b/setup.py index 8e9d0a9ab..364863137 100755 --- a/setup.py +++ b/setup.py @@ -7,6 +7,17 @@ import sys from setuptools import setup +try: + from pypandoc import convert + + def read_md(f): + return convert(f, 'rst') +except ImportError: + print("warning: pypandoc module not found, could not convert Markdown to RST") + + def read_md(f): + return open(f, 'r').read() + def get_version(package): """ @@ -68,6 +79,7 @@ setup( url='http://www.django-rest-framework.org', license='BSD', description='Web APIs for Django, made easy.', + long_description=read_md('README.md'), author='Tom Christie', author_email='tom@tomchristie.com', # SEE NOTE BELOW (*) packages=get_packages('rest_framework'), From f48ccad581cbcc0466a9418c61d73f34a3721898 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Fri, 12 Feb 2016 13:43:18 +0100 Subject: [PATCH 2/5] Fail hard during publish if pandoc isn't available. --- setup.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setup.py b/setup.py index 364863137..0fef70f1f 100755 --- a/setup.py +++ b/setup.py @@ -56,6 +56,10 @@ version = get_version('rest_framework') if sys.argv[-1] == 'publish': + try: + import pypandoc + except ImportError: + print("pypandoc not installed.\nUse `pip install pypandoc`.\nExiting.") if os.system("pip freeze | grep wheel"): print("wheel not installed.\nUse `pip install wheel`.\nExiting.") sys.exit() From 5e082314535d2f18c7596b7451de6b800ac37f71 Mon Sep 17 00:00:00 2001 From: Xavier Ordoquy Date: Wed, 17 Feb 2016 18:18:19 +0100 Subject: [PATCH 3/5] Remove informations about why the pagination didn't work. We remove a couple of informations to lower the exposition of our internals. --- rest_framework/pagination.py | 2 +- tests/test_pagination.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/rest_framework/pagination.py b/rest_framework/pagination.py index 1051dc5b2..de8777b96 100644 --- a/rest_framework/pagination.py +++ b/rest_framework/pagination.py @@ -186,7 +186,7 @@ class PageNumberPagination(BasePagination): template = 'rest_framework/pagination/numbers.html' - invalid_page_message = _('Invalid page "{page_number}": {message}.') + invalid_page_message = _('Invalid page.') def paginate_queryset(self, queryset, request, view=None): """ diff --git a/tests/test_pagination.py b/tests/test_pagination.py index c6caaf641..1c74e837c 100644 --- a/tests/test_pagination.py +++ b/tests/test_pagination.py @@ -113,7 +113,7 @@ class TestPaginationIntegration: response = self.view(request) assert response.status_code == status.HTTP_404_NOT_FOUND assert response.data == { - 'detail': 'Invalid page "0": That page number is less than 1.' + 'detail': 'Invalid page.' } def test_404_not_found_for_invalid_page(self): @@ -121,7 +121,7 @@ class TestPaginationIntegration: response = self.view(request) assert response.status_code == status.HTTP_404_NOT_FOUND assert response.data == { - 'detail': 'Invalid page "invalid": That page number is not an integer.' + 'detail': 'Invalid page.' } From c03c6c6e783b2d7c25c79bdadf2b12433dd88116 Mon Sep 17 00:00:00 2001 From: Luke Murphy Date: Wed, 24 Feb 2016 14:22:24 +0100 Subject: [PATCH 4/5] fix typo in relations docs --- docs/api-guide/relations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/api-guide/relations.md b/docs/api-guide/relations.md index ba6870bcf..b2a7d8e21 100644 --- a/docs/api-guide/relations.md +++ b/docs/api-guide/relations.md @@ -507,7 +507,7 @@ For example, given the following model for a tag, which has a generic relationsh def __unicode__(self): return self.tag_name -And the following two models, which may be have associated tags: +And the following two models, which may have associated tags: class Bookmark(models.Model): """ From a609e4e1ca98228bef7537d7770d7919ac25a047 Mon Sep 17 00:00:00 2001 From: Taranjeet Date: Fri, 26 Feb 2016 00:02:38 +0530 Subject: [PATCH 5/5] Docs: Fix repetitive word in the tutorial --- docs/tutorial/1-serialization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorial/1-serialization.md b/docs/tutorial/1-serialization.md index 239d54204..fd0783f07 100644 --- a/docs/tutorial/1-serialization.md +++ b/docs/tutorial/1-serialization.md @@ -325,7 +325,7 @@ Quit out of the shell... In another terminal window, we can test the server. -We can test our API using using [curl][curl] or [httpie][httpie]. Httpie is a user friendly http client that's written in Python. Let's install that. +We can test our API using [curl][curl] or [httpie][httpie]. Httpie is a user friendly http client that's written in Python. Let's install that. You can install httpie using pip: