
from django.conf.urls.defaults import patterns, handler500, url

urlpatterns = patterns(
    'djangosaml2.views',
    url(r'^login/$', 'login', name='saml2_login'),
    url(r'^acs/$', 'assertion_consumer_service', name='saml2_acs'),
    url(r'^logout/$', 'logout', name='saml2_logout'),
    url(r'^ls/$', 'logout_service', name='saml2_ls'),
    url(r'^metadata/$', 'metadata', name='saml2_metadata'),
)

handler500 = handler500


try:
    from django.conf.urls import patterns, handler500, url
# Fallback for Django versions < 1.4
except ImportError:
    from django.conf.urls.defaults import patterns, handler500, url

urlpatterns = patterns(
    'djangosaml2.views',
    url(r'^login/$', 'login', name='saml2_login'),
    url(r'^acs/$', 'assertion_consumer_service', name='saml2_acs'),
    url(r'^logout/$', 'logout', name='saml2_logout'),
    url(r'^ls/$', 'logout_service', name='saml2_ls'),
    url(r'^metadata/$', 'metadata', name='saml2_metadata'),
)

handler500 = handler500

Fix imports for Django 1.6 and above
Fix imports for Django 1.6 and above

  
+ try:
+     from django.conf.urls import patterns, handler500, url
+ # Fallback for Django versions < 1.4
+ except ImportError:
- from django.conf.urls.defaults import patterns, handler500, url
+     from django.conf.urls.defaults import patterns, handler500, url
  
  urlpatterns = patterns(
      'djangosaml2.views',
      url(r'^login/$', 'login', name='saml2_login'),
      url(r'^acs/$', 'assertion_consumer_service', name='saml2_acs'),
      url(r'^logout/$', 'logout', name='saml2_logout'),
      url(r'^ls/$', 'logout_service', name='saml2_ls'),
      url(r'^metadata/$', 'metadata', name='saml2_metadata'),
  )
  
  handler500 = handler500
  
Fix imports for Django 1.6 and above
## Code Before:

from django.conf.urls.defaults import patterns, handler500, url

urlpatterns = patterns(
    'djangosaml2.views',
    url(r'^login/$', 'login', name='saml2_login'),
    url(r'^acs/$', 'assertion_consumer_service', name='saml2_acs'),
    url(r'^logout/$', 'logout', name='saml2_logout'),
    url(r'^ls/$', 'logout_service', name='saml2_ls'),
    url(r'^metadata/$', 'metadata', name='saml2_metadata'),
)

handler500 = handler500

## Instruction:
Fix imports for Django 1.6 and above
## Code After:

try:
    from django.conf.urls import patterns, handler500, url
# Fallback for Django versions < 1.4
except ImportError:
    from django.conf.urls.defaults import patterns, handler500, url

urlpatterns = patterns(
    'djangosaml2.views',
    url(r'^login/$', 'login', name='saml2_login'),
    url(r'^acs/$', 'assertion_consumer_service', name='saml2_acs'),
    url(r'^logout/$', 'logout', name='saml2_logout'),
    url(r'^ls/$', 'logout_service', name='saml2_ls'),
    url(r'^metadata/$', 'metadata', name='saml2_metadata'),
)

handler500 = handler500
