Revision 269ac8de

b/snf-astakos-app/astakos/api/keystone_urls.py
32 32
# or implied, of GRNET S.A.
33 33

  
34 34
from django.conf.urls.defaults import patterns, url
35
from snf_django.lib.api import api_endpoint_not_found
35 36

  
36 37
urlpatterns = patterns(
37 38
    'astakos.api.tokens',
38 39
    url(r'^v2.0/tokens/?$', 'authenticate', name='tokens_authenticate'),
40
    url(r'^.*', api_endpoint_not_found),
39 41
)
b/snf-astakos-app/astakos/api/urls.py
32 32
# or implied, of GRNET S.A.
33 33

  
34 34
from django.conf.urls.defaults import patterns, url, include
35
from snf_django.lib.api import api_endpoint_not_found
35 36

  
36 37

  
37 38
astakos_account_v1_0 = patterns(
......
60 61
urlpatterns = patterns(
61 62
    '',
62 63
    url(r'^v1.0/', include(astakos_account_v1_0)),
64
    (r'^.*', api_endpoint_not_found),
63 65
)
/dev/null
1
# Copyright 2011, 2012, 2013 GRNET S.A. All rights reserved.
2
#
3
# Redistribution and use in source and binary forms, with or
4
# without modification, are permitted provided that the following
5
# conditions are met:
6
#
7
#   1. Redistributions of source code must retain the above
8
#      copyright notice, this list of conditions and the following
9
#      disclaimer.
10
#
11
#   2. Redistributions in binary form must reproduce the above
12
#      copyright notice, this list of conditions and the following
13
#      disclaimer in the documentation and/or other materials
14
#      provided with the distribution.
15
#
16
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
# POSSIBILITY OF SUCH DAMAGE.
28
#
29
# The views and conclusions contained in the software and
30
# documentation are those of the authors and should not be
31
# interpreted as representing official policies, either expressed
32
# or implied, of GRNET S.A.
33

  
34
from snf_django.lib.api import faults
35
from synnefo.api.util import api_method
36

  
37

  
38
@api_method()
39
def not_found(request):
40
    raise faults.BadRequest('Not found.')
41

  
42

  
43
@api_method()
44
def method_not_allowed(request):
45
    raise faults.BadRequest('Method not allowed')
b/snf-cyclades-app/synnefo/api/urls.py
33 33

  
34 34
from django.conf.urls.defaults import include, patterns
35 35

  
36
from snf_django.lib.api import not_found
36
from snf_django.lib.api import api_endpoint_not_found
37 37
from synnefo.api import servers, flavors, images, networks
38 38
from synnefo.api.versions import versions_list, version_details
39 39

  
......
56 56
    (r'^v2.0/(?:.json|.xml|.atom)?$', version_details,
57 57
        {'api_version': 'v1.1'}),
58 58
    (r'^v2.0/', include(api20_patterns)),
59
    (r'^.+', not_found),
59
    (r'^.*', api_endpoint_not_found),
60 60
)
b/snf-cyclades-app/synnefo/plankton/urls.py
33 33

  
34 34
from django.conf.urls.defaults import patterns, include
35 35
from django.http import HttpResponseNotAllowed
36
from snf_django.lib.api import api_endpoint_not_found
36 37

  
37 38
from synnefo.plankton import views
38 39

  
......
90 91
urlpatterns = patterns(
91 92
    '',
92 93
    (r'^v1.0/', include(image_v1_patterns)),
94
    (r'^.*', api_endpoint_not_found),
93 95
)
b/snf-django-lib/snf_django/lib/api/__init__.py
210 210
    return response
211 211

  
212 212

  
213
def not_found(request):
214
    raise faults.BadRequest('Not found.')
213
@api_method(token_required=False, user_required=False)
214
def api_endpoint_not_found(request):
215
    raise faults.BadRequest("API endpoint not found")
215 216

  
216 217

  
217
def method_not_allowed(request):
218
@api_method(token_required=False, user_required=False)
219
def api_method_not_allowed(request):
218 220
    raise faults.BadRequest('Method not allowed')
b/snf-pithos-app/pithos/api/urls.py
36 36
from snf_django.lib.api.proxy import proxy
37 37
from snf_django.lib.api.utils import prefix_pattern
38 38
from snf_django.lib.api.urls import api_patterns
39
from snf_django.lib.api import api_endpoint_not_found
39 40
from pithos.api.settings import (
40 41
    BASE_PATH, ASTAKOS_BASE_URL, BASE_ASTAKOS_PROXY_PATH,
41 42
    ASTAKOS_ACCOUNTS_PREFIX, PROXY_USER_SERVICES,
......
61 62
    '',
62 63
    (r'{0}v1/'.format(prefix_pattern(PITHOS_PREFIX)),
63 64
        include(pithos_api_patterns)),
65
    (r'{0}.*'.format(prefix_pattern(PITHOS_PREFIX)),
66
        api_endpoint_not_found),
64 67
    (r'{0}(?P<v_public>.+?)/?$'.format(prefix_pattern(PUBLIC_PREFIX)),
65 68
        'pithos.api.public.public_demux'),
66 69
    (r'{0}'.format(prefix_pattern(UI_PREFIX)),

Also available in: Unified diff