Remove unused code 89/29089/1
authorfengyuanxing <feng.yuanxing@zte.com.cn>
Thu, 25 Jan 2018 02:18:17 +0000 (10:18 +0800)
committerfengyuanxing <feng.yuanxing@zte.com.cn>
Thu, 25 Jan 2018 02:18:17 +0000 (10:18 +0800)
Change-Id: Ie92b00114a901cda3d2b954a23bd7bc170f5065e
Issue-ID: VFC-677
Signed-off-by: fengyuanxing <feng.yuanxing@zte.com.cn>
catalog/urls.py

index 0732f48..291e9f9 100644 (file)
 
 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))