def test_allow_public_decorator(self): def foo(): pass eq_(getattr(foo, '_allow_public', None), None) allow_public(foo) ok_(foo._allow_public)
def test_allow_public_decorator(self): def foo(): pass eq_(getattr(foo, "_allow_public", None), None) allow_public(foo) ok_(foo._allow_public)
handler404 = lambda r: error_page(r, 404) handler500 = lambda r: error_page(r, 500) handler_csrf = lambda r, cb=None: error_page(r, 'csrf_error', status=400) urlpatterns = patterns( '', url(r'^browserid/', include('django_browserid.urls')), url(r'^api/', include('mozillians.api.urls')), url(r'', include('mozillians.groups.urls', 'groups')), url(r'', include('mozillians.phonebook.urls', 'phonebook')), # Admin URLs. url(r'^admin/', include(admin.site.urls)), url(r'^_autocomplete/', include('autocomplete_light.urls')), url(r'^jsi18n/$', allow_public(cache_page(60 * 60 * 24 * 365)(javascript_catalog)), { 'domain': 'javascript', 'packages': ['mozillians'] }, name='jsi18n'), url(r'', include('mozillians.humans.urls', 'humans')), ) # In DEBUG mode, serve media files through Django, and serve error pages # via predictable routes. Add in qunit tests. if settings.DEBUG: # Remove leading and trailing slashes so the regex matches. urlpatterns += patterns( '', # Add the 404, 500, and csrf pages for testing url(r'^404/$', handler404),
url(r'^login/$', 'views.login', name='login'), url(r'^logout/$', 'views.logout', name='logout'), url(r'^register/$', 'views.register', name='register'), url(r'^user/edit/$', 'views.edit_profile', name='profile_edit'), url(r'^u/(?P<username>[\w.@+-]+)/$', 'views.view_profile', name='profile_view'), url(r'^confirm-delete/$', 'views.confirm_delete', name='profile_confirm_delete'), url(r'^delete/$', 'views.delete', name='profile_delete'), url(r'^opensearch.xml$', 'views.search_plugin', name='search_plugin'), url(r'^search/$', 'views.search', name='search'), url(r'^vouch/$', 'views.vouch', name='vouch'), url(r'^invite/$', 'views.invite', name='invite'), url(r'^invite/(?P<invite_pk>\d+)/delete/$', 'views.delete_invite', name='delete_invite'), url(r'^country/(?P<country>[A-Za-z]+)/$', 'views.list_mozillians_in_location', name='list_country'), url(r'^country/(?P<country>[A-Za-z]+)/city/(?P<city>.+)/$', 'views.list_mozillians_in_location', name='list_city'), url((r'^country/(?P<country>[A-Za-z]+)/' 'region/(?P<region>.+)/city/(?P<city>.+)/$'), 'views.list_mozillians_in_location', name='list_region_city'), url(r'^country/(?P<country>[A-Za-z]+)/region/(?P<region>.+)/$', 'views.list_mozillians_in_location', name='list_region'), # Static pages need csrf for browserID post to work url(r'^about/$', allow_public(TemplateView.as_view(template_name='phonebook/about.html')), name='about'), )
handler_csrf = lambda r, cb=None: error_page(r, 'csrf_error', status=400) urlpatterns = patterns( '', url(r'^browserid/', include('django_browserid.urls')), url(r'^api/', include('mozillians.api.urls')), url(r'', include('mozillians.groups.urls', 'groups')), url(r'', include('mozillians.phonebook.urls')), # Admin URLs. url(r'^admin/', include(admin.site.urls)), url(r'^_autocomplete/', include('autocomplete_light.urls')), url(r'^jsi18n/$', allow_public(cache_page(60 * 60 * 24 * 365)(javascript_catalog)), {'domain': 'javascript', 'packages': ['mozillians']}, name='jsi18n'), ) # In DEBUG mode, serve media files through Django, and serve error pages # via predictable routes. Add in qunit tests. if settings.DEBUG: # Remove leading and trailing slashes so the regex matches. media_url = settings.MEDIA_URL.lstrip('/').rstrip('/') urlpatterns += patterns('', (r'^%s/(?P<path>.*)' % media_url, 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), # Add the 404, 500, and csrf pages for testing (r'^404/$', handler404), (r'^500/$', handler500), (r'^csrf/$', handler_csrf),
name='profile_view'), url(r'^u/(?P<username>[\w.@+-]+)/vouch/$', 'views.vouch', name='profile_vouch'), url(r'^user/delete_idp_profiles/$', 'views.delete_idp_profiles', name='delete_idp_profiles'), url(r'^u/(?P<username>[\w.@+-]+)/unvouch/$', 'views.unvouch', name='profile_unvouch'), url(r'^confirm-delete/$', 'views.confirm_delete', name='profile_confirm_delete'), url(r'^delete/$', 'views.delete', name='profile_delete'), url(r'^opensearch.xml$', 'views.search_plugin', name='search_plugin'), url(r'^invite/$', 'views.invite', name='invite'), url(r'^invite/(?P<invite_pk>\d+)/delete/$', 'views.delete_invite', name='delete_invite'), url(r'^apikeys/$', 'views.apikeys', name='apikeys'), url(r'^apikey/(?P<api_pk>\d+)/delete/$', 'views.delete_apikey', name='apikey_delete'), # Haystack search url(r'^search/$', allow_public(PhonebookSearchView.as_view()), name='haystack_search'), url(r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/$', PhonebookSearchView.as_view(), name='list_country'), url(r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/city/(?P<city>.+)/$', PhonebookSearchView.as_view(), name='list_city'), url((r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/' 'region/(?P<region>.+)/city/(?P<city>.+)/$'), PhonebookSearchView.as_view(), name='list_region_city'), url(r'^country/(?P<country>[A-Za-z0-9 \.]+)/region/(?P<region>.+)/$', PhonebookSearchView.as_view(), name='list_region'), # Static pages need csrf for post to work url(r'^about/$', allow_public(TemplateView.as_view(template_name='phonebook/about.html')), name='about'), url(r'^about/dinomcvouch$',
import views urlpatterns = patterns('', url('^$', views.home, name='home'), url('^user/edit/$', views.edit_profile, name='profile.edit'), url('^confirm-delete/$', views.confirm_delete, name='profile.delete_confirm'), url('^delete/$', views.delete, name='profile.delete'), url('^opensearch.xml$', views.search_plugin, name='search_plugin'), url('^search/$', views.search, name='search'), url('^vouch/$', views.vouch, name='vouch'), url('^invite/$', views.invite, name='invite'), url('^country/(?P<country>[A-Za-z]+)/$', views.list_mozillians_in_location, name='list_country'), url('^country/(?P<country>[A-Za-z]+)/city/(?P<city>.+)/$', views.list_mozillians_in_location, name='list_city'), url(('^country/(?P<country>[A-Za-z]+)/' 'region/(?P<region>.+)/city/(?P<city>.+)/$'), views.list_mozillians_in_location, name='list_region_city'), url('^country/(?P<country>[A-Za-z]+)/region/(?P<region>.+)/$', views.list_mozillians_in_location, name='list_region'), # Static pages need csrf for browserID post to work url('^about/$', allow_public(direct_to_template), {'template': 'phonebook/about.html'}, name='about'), url(r'^u/(?P<username>[\w.@+-]+)/$', views.view_profile, name='profile'), )
url( r"^user/delete/identity/(?P<identity_pk>\d+)/$", phonebook_views.delete_identity, name="delete_identity", ), url( r"^confirm-delete/$", phonebook_views.confirm_delete, name="profile_confirm_delete", ), url(r"^delete/$", phonebook_views.delete, name="profile_delete"), url( r"^user/delete_idp_profiles/$", phonebook_views.delete_idp_profiles, name="delete_idp_profiles", ), # Static pages need csrf for post to work url( r"^about/$", allow_public(TemplateView.as_view(template_name="phonebook/about.html")), name="about", ), url( r"^about/dinomcvouch$", allow_public( TemplateView.as_view(template_name="phonebook/about-dinomcvouch.html") ), name="about-dinomcvouch", ), ]
urlpatterns = patterns( "mozillians.phonebook", url(r"^$", "views.home", name="home"), url(r"^login/$", "views.login", name="login"), url(r"^logout/$", "views.logout", name="logout"), url(r"^register/$", "views.register", name="register"), url(r"^user/edit/$", "views.edit_profile", name="profile_edit"), url(r"^u/(?P<username>[\w.@+-]+)/$", "views.view_profile", name="profile_view"), url(r"^confirm-delete/$", "views.confirm_delete", name="profile_confirm_delete"), url(r"^delete/$", "views.delete", name="profile_delete"), url(r"^opensearch.xml$", "views.search_plugin", name="search_plugin"), url(r"^search/$", "views.search", name="search"), url(r"^vouch/$", "views.vouch", name="vouch"), url(r"^invite/$", "views.invite", name="invite"), url(r"^country/(?P<country>[A-Za-z]+)/$", "views.list_mozillians_in_location", name="list_country"), url(r"^country/(?P<country>[A-Za-z]+)/city/(?P<city>.+)/$", "views.list_mozillians_in_location", name="list_city"), url( (r"^country/(?P<country>[A-Za-z]+)/" "region/(?P<region>.+)/city/(?P<city>.+)/$"), "views.list_mozillians_in_location", name="list_region_city", ), url( r"^country/(?P<country>[A-Za-z]+)/region/(?P<region>.+)/$", "views.list_mozillians_in_location", name="list_region", ), # Static pages need csrf for browserID post to work url(r"^about/$", allow_public(direct_to_template), {"template": "phonebook/about.html"}, name="about"), )
url(r'^confirm-delete/$', 'views.confirm_delete', name='profile_confirm_delete'), url(r'^delete/$', 'views.delete', name='profile_delete'), url(r'^opensearch.xml$', 'views.search_plugin', name='search_plugin'), url(r'^invite/$', 'views.invite', name='invite'), url(r'^invite/(?P<invite_pk>\d+)/delete/$', 'views.delete_invite', name='delete_invite'), url(r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/$', 'views.list_mozillians_in_location', name='list_country'), url(r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/city/(?P<city>.+)/$', 'views.list_mozillians_in_location', name='list_city'), url((r'^country/(?P<country>[A-Za-z0-9 \.\,]+)/' 'region/(?P<region>.+)/city/(?P<city>.+)/$'), 'views.list_mozillians_in_location', name='list_region_city'), url(r'^country/(?P<country>[A-Za-z0-9 \.]+)/region/(?P<region>.+)/$', 'views.list_mozillians_in_location', name='list_region'), url(r'^apikeys/$', 'views.apikeys', name='apikeys'), url(r'^apikey/(?P<api_pk>\d+)/delete/$', 'views.delete_apikey', name='apikey_delete'), # Haystack search url(r'^search/$', allow_public(PhonebookSearchView.as_view()), name='haystack_search'), # Static pages need csrf for post to work url(r'^about/$', allow_public(TemplateView.as_view(template_name='phonebook/about.html')), name='about'), url(r'^about/dinomcvouch$', allow_public(TemplateView.as_view(template_name='phonebook/about-dinomcvouch.html')), name='about-dinomcvouch'), # CSP violation URL url(r'^capture-csp-violation$', 'views.capture_csp_violation', name='capture-csp-violation'), )
urlpatterns = patterns('mozillians.phonebook', url(r'^$', 'views.home', name='home'), url(r'^login/$', 'views.login', name='login'), url(r'^logout/$', 'views.logout', name='logout'), url(r'^register/$', 'views.register', name='register'), url(r'^user/edit/$', 'views.edit_profile', name='profile_edit'), url(r'^u/(?P<username>[\w.@+-]+)/$', 'views.view_profile', name='profile_view'), url(r'^confirm-delete/$', 'views.confirm_delete', name='profile_confirm_delete'), url(r'^delete/$', 'views.delete', name='profile_delete'), url(r'^opensearch.xml$', 'views.search_plugin', name='search_plugin'), url(r'^search/$', 'views.search', name='search'), url(r'^vouch/$', 'views.vouch', name='vouch'), url(r'^invite/$', 'views.invite', name='invite'), url(r'^country/(?P<country>[A-Za-z]+)/$', 'views.list_mozillians_in_location', name='list_country'), url(r'^country/(?P<country>[A-Za-z]+)/city/(?P<city>.+)/$', 'views.list_mozillians_in_location', name='list_city'), url((r'^country/(?P<country>[A-Za-z]+)/' 'region/(?P<region>.+)/city/(?P<city>.+)/$'), 'views.list_mozillians_in_location', name='list_region_city'), url(r'^country/(?P<country>[A-Za-z]+)/region/(?P<region>.+)/$', 'views.list_mozillians_in_location', name='list_region'), # Static pages need csrf for browserID post to work url(r'^about/$', allow_public(direct_to_template), {'template': 'phonebook/about.html'}, name='about'), )
'views.confirm_delete', name='profile_confirm_delete'), url(r'^delete/$', 'views.delete', name='profile_delete'), url(r'^opensearch.xml$', 'views.search_plugin', name='search_plugin'), url(r'^search/$', 'views.search', name='search'), url(r'^vouch/$', 'views.vouch', name='vouch'), url(r'^invite/$', 'views.invite', name='invite'), url(r'^invite/(?P<invite_pk>\d+)/delete/$', 'views.delete_invite', name='delete_invite'), url(r'^country/(?P<country>[A-Za-z]+)/$', 'views.list_mozillians_in_location', name='list_country'), url(r'^country/(?P<country>[A-Za-z]+)/city/(?P<city>.+)/$', 'views.list_mozillians_in_location', name='list_city'), url((r'^country/(?P<country>[A-Za-z]+)/' 'region/(?P<region>.+)/city/(?P<city>.+)/$'), 'views.list_mozillians_in_location', name='list_region_city'), url(r'^country/(?P<country>[A-Za-z]+)/region/(?P<region>.+)/$', 'views.list_mozillians_in_location', name='list_region'), # Static pages need csrf for browserID post to work url(r'^about/$', allow_public( TemplateView.as_view(template_name='phonebook/about.html')), name='about'), )
url(r'^u/(?P<username>[\w.@+-]+)/$', 'views.view_profile', name='profile_view'), url(r'^confirm-delete/$', 'views.confirm_delete', name='profile_confirm_delete'), url(r'^delete/$', 'views.delete', name='profile_delete'), url(r'^opensearch.xml$', 'views.search_plugin', name='search_plugin'), url(r'^search/$', 'views.search', name='search'), url(r'^vouch/$', 'views.vouch', name='vouch'), url(r'^invite/$', 'views.invite', name='invite'), url(r'^country/(?P<country>[A-Za-z]+)/$', 'views.list_mozillians_in_location', name='list_country'), url(r'^country/(?P<country>[A-Za-z]+)/city/(?P<city>.+)/$', 'views.list_mozillians_in_location', name='list_city'), url((r'^country/(?P<country>[A-Za-z]+)/' 'region/(?P<region>.+)/city/(?P<city>.+)/$'), 'views.list_mozillians_in_location', name='list_region_city'), url(r'^country/(?P<country>[A-Za-z]+)/region/(?P<region>.+)/$', 'views.list_mozillians_in_location', name='list_region'), # Static pages need csrf for browserID post to work url(r'^about/$', allow_public(direct_to_template), {'template': 'phonebook/about.html'}, name='about'), )