Skip to content

Commit

Permalink
[#2939] Update and add wrappers to group controller for org hijacking
Browse files Browse the repository at this point in the history
  • Loading branch information
tobes committed Sep 27, 2012
1 parent c46a34e commit eb8be2b
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions ckan/controllers/group.py
Expand Up @@ -66,10 +66,24 @@ def _replace_group_org(self, string):
return string

def _action(self, action_name):
if self.group_type == 'organization':
action_name = action_name.replace('group', 'organization')
print action_name
return get_action(action_name)
''' select the correct group/org action '''
return get_action(self._replace_group_org(action_name))

def _render_template(self, template_name):
''' render the correct group/org template '''
return render(self._replace_group_org(template_name))

def _redirect_to(self, *args, **kw):
''' wrapper to ensue the correct controller is used '''
if self.group_type == 'organization' and 'controller' in kw:
kw['controller'] = 'organization'
return h.redirect_to(*args, **kw)

def _url_for(self, *args, **kw):
''' wrapper to ensue the correct controller is used '''
if self.group_type == 'organization' and 'controller' in kw:
kw['controller'] = 'organization'
return h.url_for(*args, **kw)

def _guess_group_type(self, expecting_name=False):
"""
Expand Down

0 comments on commit eb8be2b

Please sign in to comment.