Skip to content

Commit

Permalink
Merge branch 'metaodi-2771-group-controller-on-igroupform'
Browse files Browse the repository at this point in the history
  • Loading branch information
amercader committed Dec 16, 2015
2 parents 940c35e + 0b8395e commit 1ed75d3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ckan/lib/plugins.py
Expand Up @@ -341,6 +341,9 @@ class DefaultGroupForm(object):
Note - this isn't a plugin implementation. This is deliberate, as we
don't want this being registered.
"""
def group_controller(self):
return 'group'

def new_template(self):
"""
Returns a string representing the location of the template to be
Expand Down Expand Up @@ -491,6 +494,9 @@ def setup_template_variables(self, context, data_dict):


class DefaultOrganizationForm(DefaultGroupForm):
def group_controller(self):
return 'organization'

def group_form(self):
return 'organization/new_organization_form.html'

Expand Down
12 changes: 12 additions & 0 deletions ckan/plugins/interfaces.py
Expand Up @@ -1188,6 +1188,7 @@ class IGroupForm(Interface):
- is_fallback(self)
- group_types(self)
- group_controller(self)
Implementations might want to consider mixing in
ckan.lib.plugins.DefaultGroupForm which provides
Expand Down Expand Up @@ -1220,6 +1221,17 @@ def group_types(self):
type will raise an exception at startup.
"""

def group_controller(self):
"""
Returns the name of the group controller.
The group controller is the controller, that is used to handle requests
of the group type(s) of this plugin.
If this method is not provided, the default group controller is used
(`group`).
"""

##### End of control methods

##### Hooks for customising the GroupController's behaviour #####
Expand Down

0 comments on commit 1ed75d3

Please sign in to comment.