1 |
8ea2a53b
|
Serghei MIHAI
|
from pylons import config
|
2 |
|
|
|
3 |
|
|
import ckan.plugins as plugins
|
4 |
|
|
import ckan.plugins.toolkit as toolkit
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
class OzwilloRoutesPlugin(plugins.SingletonPlugin):
|
8 |
|
|
plugins.implements(plugins.IRoutes)
|
9 |
|
|
|
10 |
|
|
def before_map(self, map):
|
11 |
|
|
# parameter defined in deployment config file
|
12 |
|
|
# for example user_profile_edit_url = https://portal.oasis-eu.org/my/profile
|
13 |
|
|
user_profile_url = config.get('ckanext.ozwillo_routes.user_profile_edit_url', '/')
|
14 |
|
|
map.redirect('/user/edit', user_profile_url)
|
15 |
|
|
map.redirect('/user/edit/{id:.*}', user_profile_url)
|
16 |
|
|
map.redirect('/user/reset', user_profile_url)
|
17 |
|
|
return map
|
18 |
|
|
|
19 |
|
|
def after_map(self, map):
|
20 |
|
|
return map
|