summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfengyuanxing <feng.yuanxing@zte.com.cn>2018-01-25 10:18:17 +0800
committerfengyuanxing <feng.yuanxing@zte.com.cn>2018-01-25 10:18:17 +0800
commitcf0d081bbc3b4ebdce906d3543253624c4c94f51 (patch)
treecc17ef7417487524b296d2ae6cb0ce7008707732
parent8d42e33435ba3f3f83bda319865e1c1e828e1ef0 (diff)
Remove unused code
Change-Id: Ie92b00114a901cda3d2b954a23bd7bc170f5065e Issue-ID: VFC-677 Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
-rw-r--r--catalog/urls.py39
1 files changed, 18 insertions, 21 deletions
diff --git a/catalog/urls.py b/catalog/urls.py
index 0732f484..291e9f92 100644
--- a/catalog/urls.py
+++ b/catalog/urls.py
@@ -14,10 +14,8 @@
from django.conf.urls import include, url
from catalog.pub.config.config import REG_TO_MSB_WHEN_START, REG_TO_MSB_REG_URL, REG_TO_MSB_REG_PARAM
-
-import user_agents
-from django.shortcuts import redirect
from rest_framework import permissions
+
from drf_yasg import openapi
from drf_yasg.views import get_schema_view
@@ -36,26 +34,22 @@ SchemaView = get_schema_view(
)
-def root_redirect(request):
- user_agent_string = request.META.get('HTTP_USER_AGENT', '')
- user_agent = user_agents.parse(user_agent_string)
- if user_agent.is_mobile:
- schema_view = 'cschema-redoc'
- else:
- schema_view = 'cschema-swagger-ui'
- return redirect(schema_view, permanent=True)
-
-
urlpatterns = [
# Add code for generating swagger automatically.
- url(r'^swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=0), name='schema-json'),
- url(r'^swagger/$', SchemaView.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
- url(r'^redoc/$', SchemaView.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
- url(r'^cached/swagger(?P<format>.json|.yaml)$', SchemaView.without_ui(cache_timeout=None), name='cschema-json'),
- url(r'^cached/swagger/$', SchemaView.with_ui('swagger', cache_timeout=None), name='cschema-swagger-ui'),
- url(r'^cached/redoc/$', SchemaView.with_ui('redoc', cache_timeout=None), name='cschema-redoc'),
- url(r'^$', root_redirect),
+ url(r'^swagger(?P<format>.json|.yaml)$',
+ SchemaView.without_ui(cache_timeout=0),
+ name='schema-json'),
+ url(r'^swagger/$', SchemaView.with_ui('swagger',
+ cache_timeout=0), name='schema-swagger-ui'),
+ url(r'^redoc/$', SchemaView.with_ui('redoc',
+ cache_timeout=0), name='schema-redoc'),
+ url(r'^cached/swagger(?P<format>.json|.yaml)$',
+ SchemaView.without_ui(cache_timeout=None), name='cschema-json'),
+ url(r'^cached/swagger/$', SchemaView.with_ui('swagger',
+ cache_timeout=None), name='cschema-swagger-ui'),
+ url(r'^cached/redoc/$', SchemaView.with_ui('redoc',
+ cache_timeout=None), name='cschema-redoc'),
url(r'^', include('catalog.samples.urls')),
url(r'^', include('catalog.packages.urls')),
url(r'^', include('catalog.jobs.urls')),
@@ -66,4 +60,7 @@ urlpatterns = [
if REG_TO_MSB_WHEN_START:
import json
from catalog.pub.utils.restcall import req_by_msb
- req_by_msb(REG_TO_MSB_REG_URL, "POST", json.JSONEncoder().encode(REG_TO_MSB_REG_PARAM))
+ req_by_msb(
+ REG_TO_MSB_REG_URL,
+ "POST",
+ json.JSONEncoder().encode(REG_TO_MSB_REG_PARAM))