'patchwork',
]
+try:
+ # django rest framework isn't a standard package in most distros, so
+ # don't make it compulsory
+ import rest_framework # NOQA
+ INSTALLED_APPS += ['rest_framework']
+except ImportError:
+ pass
+
# HTTP
MIDDLEWARE_CLASSES = [
# Set to True to enable the Patchwork XML-RPC interface
ENABLE_XMLRPC = False
+# Set to True to enable the Patchwork REST API
+ENABLE_REST_API = False
+
# Set to True to enable redirections or URLs from previous versions
# of patchwork
COMPAT_REDIR = True
name='pwclientrc'),
]
+if settings.ENABLE_REST_API:
+ if 'rest_framework' not in settings.INSTALLED_APPS:
+ raise RuntimeError(
+ 'djangorestframework must be installed to enable the REST API.')
+ import patchwork.views.rest_api
+ urlpatterns += [
+ url(r'^api/1.0/', include(patchwork.views.rest_api.router.urls)),
+ ]
+
# redirect from old urls
if settings.COMPAT_REDIR:
urlpatterns += [
--- /dev/null
+# Patchwork - automated patch tracking system
+# Copyright (C) 2016 Linaro Corporation
+#
+# This file is part of the Patchwork package.
+#
+# Patchwork is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Patchwork is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Patchwork; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+from rest_framework import routers
+
+router = routers.DefaultRouter()