cc1  v2.1
CC1 source code docs
 All Classes Namespaces Files Functions Variables Pages
public_ip.py
Go to the documentation of this file.
1 # -*- coding: utf-8 -*-
2 # @COPYRIGHT_begin
3 #
4 # Copyright [2010-2014] Institute of Nuclear Physics PAN, Krakow, Poland
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #
18 # @COPYRIGHT_end
19 
20 ##
21 # @package src.wi.urls.user.public_ip
22 # @author Piotr Wójcik
23 # @date 19.11.2010
24 #
25 
26 from django.conf.urls import patterns, url, include
27 from django.utils.translation import ugettext_lazy as _
28 
29 from wi.utils.decorators import user_permission
30 from wi.utils.views import direct_to_template, get_list_generic, simple_generic, simple_generic_id
31 
32 
33 resources_patterns = patterns('wi.views.user.public_ip',
34 
35  url(r'^$', user_permission(direct_to_template), {'template_name': 'resources/base.html'}, name='res_resources'),
36 
37  url(r'^elastic_ip/$', user_permission(direct_to_template), {'template_name': 'resources/elastic_ip.html'}, name='res_elastic_ip'),
38  url(r'^ajax/ips_table/$', user_permission(get_list_generic), {'request_url': 'user/public_ip/get_list/'}, name='res_ajax_get_ips_table'),
39  url(r'^ajax/add_ip/$', user_permission(simple_generic),
40  {'template_name': 'generic/simple.html',
41  'success_msg': (lambda desc: _('New IP address has been added.') % {'desc': desc}),
42  'ask_msg': (lambda desc: _('Do you want to add an IP address?') % {'desc': desc}),
43  'request_url': 'user/public_ip/request/',
44  },
45  name='res_ajax_request_ip'),
46  url(r'^ajax/release_ip/(?P<id1>\d+)/$', user_permission(simple_generic_id),
47  {'template_name': 'generic/simple.html',
48  'success_msg': (lambda desc: _('IP address <b>%(desc)s</b> has been released.') % {'desc': desc}),
49  'ask_msg': (lambda desc: _('Do you want to release IP address <b>%(desc)s</b>?') % {'desc': desc}),
50  'request_url': 'user/public_ip/release/',
51  'id_key': 'public_ip_id',
52  },
53  name='res_ajax_release_ip'),
54  )
55 
56 urlpatterns = patterns('',
57  url(r'^resources/', include(resources_patterns)),
58 )
59