
from django.conf.urls import patterns, url
from django.contrib.auth.decorators import permission_required

from . import views

protect = permission_required('gallery.view')

urlpatterns = patterns('',
    url(r'^$', protect(views.GalleryIndexView.as_view()), name='gallery-index'),
    url(r'^year/(?P<year>\d{4})/$', protect(views.GalleryYearView.as_view()), name='gallery-year'),
    url(r'^album/(?P<pk>\d+)/$', protect(views.AlbumView.as_view()), name='gallery-album'),
    url(r'^photo/(?P<pk>\d+)/$', protect(views.PhotoView.as_view()), name='gallery-photo'),
    url(r'^original/(?P<pk>\d+)/$', protect(views.original_photo), name='gallery-photo-original'),
    url(r'^(?P<preset>\w+)/(?P<pk>\d+)/$', protect(views.resized_photo), name='gallery-photo-resized'),
)


from django.conf.urls import patterns, url

from . import views


urlpatterns = patterns('',
    url(r'^$', views.GalleryIndexView.as_view(), name='gallery-index'),
    url(r'^year/(?P<year>\d{4})/$', views.GalleryYearView.as_view(), name='gallery-year'),
    url(r'^album/(?P<pk>\d+)/$', views.AlbumView.as_view(), name='gallery-album'),
    url(r'^photo/(?P<pk>\d+)/$', views.PhotoView.as_view(), name='gallery-photo'),
    url(r'^original/(?P<pk>\d+)/$', views.original_photo, name='gallery-photo-original'),
    url(r'^(?P<preset>\w+)/(?P<pk>\d+)/$', views.resized_photo, name='gallery-photo-resized'),
)

Remove blanket protection in preparation for granular access control.
Remove blanket protection in preparation for granular access control.

  
  from django.conf.urls import patterns, url
- from django.contrib.auth.decorators import permission_required
  
  from . import views
  
- protect = permission_required('gallery.view')
  
  urlpatterns = patterns('',
-     url(r'^$', protect(views.GalleryIndexView.as_view()), name='gallery-index'),
+     url(r'^$', views.GalleryIndexView.as_view(), name='gallery-index'),
-     url(r'^year/(?P<year>\d{4})/$', protect(views.GalleryYearView.as_view()), name='gallery-year'),
+     url(r'^year/(?P<year>\d{4})/$', views.GalleryYearView.as_view(), name='gallery-year'),
-     url(r'^album/(?P<pk>\d+)/$', protect(views.AlbumView.as_view()), name='gallery-album'),
+     url(r'^album/(?P<pk>\d+)/$', views.AlbumView.as_view(), name='gallery-album'),
-     url(r'^photo/(?P<pk>\d+)/$', protect(views.PhotoView.as_view()), name='gallery-photo'),
+     url(r'^photo/(?P<pk>\d+)/$', views.PhotoView.as_view(), name='gallery-photo'),
-     url(r'^original/(?P<pk>\d+)/$', protect(views.original_photo), name='gallery-photo-original'),
+     url(r'^original/(?P<pk>\d+)/$', views.original_photo, name='gallery-photo-original'),
-     url(r'^(?P<preset>\w+)/(?P<pk>\d+)/$', protect(views.resized_photo), name='gallery-photo-resized'),
+     url(r'^(?P<preset>\w+)/(?P<pk>\d+)/$', views.resized_photo, name='gallery-photo-resized'),
  )
  
Remove blanket protection in preparation for granular access control.
## Code Before:

from django.conf.urls import patterns, url
from django.contrib.auth.decorators import permission_required

from . import views

protect = permission_required('gallery.view')

urlpatterns = patterns('',
    url(r'^$', protect(views.GalleryIndexView.as_view()), name='gallery-index'),
    url(r'^year/(?P<year>\d{4})/$', protect(views.GalleryYearView.as_view()), name='gallery-year'),
    url(r'^album/(?P<pk>\d+)/$', protect(views.AlbumView.as_view()), name='gallery-album'),
    url(r'^photo/(?P<pk>\d+)/$', protect(views.PhotoView.as_view()), name='gallery-photo'),
    url(r'^original/(?P<pk>\d+)/$', protect(views.original_photo), name='gallery-photo-original'),
    url(r'^(?P<preset>\w+)/(?P<pk>\d+)/$', protect(views.resized_photo), name='gallery-photo-resized'),
)

## Instruction:
Remove blanket protection in preparation for granular access control.
## Code After:

from django.conf.urls import patterns, url

from . import views


urlpatterns = patterns('',
    url(r'^$', views.GalleryIndexView.as_view(), name='gallery-index'),
    url(r'^year/(?P<year>\d{4})/$', views.GalleryYearView.as_view(), name='gallery-year'),
    url(r'^album/(?P<pk>\d+)/$', views.AlbumView.as_view(), name='gallery-album'),
    url(r'^photo/(?P<pk>\d+)/$', views.PhotoView.as_view(), name='gallery-photo'),
    url(r'^original/(?P<pk>\d+)/$', views.original_photo, name='gallery-photo-original'),
    url(r'^(?P<preset>\w+)/(?P<pk>\d+)/$', views.resized_photo, name='gallery-photo-resized'),
)
