Skip to content

Commit

Permalink
reformat and removed imports from ckan/ckan/lib/plugins.py
Browse files Browse the repository at this point in the history
  • Loading branch information
domoritz committed Sep 25, 2012
1 parent ae5d0a7 commit b838d56
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions ckan/lib/plugins.py
Expand Up @@ -78,7 +78,7 @@ def register_package_plugins(map):
controller='package', action='read')
map.connect('%s_action' % package_type,
'/%s/{action}/{id}' % package_type, controller='package',
requirements=dict(action='|'.join(['edit', 'authz', 'history' ]))
requirements=dict(action='|'.join(['edit', 'authz', 'history']))
)

if package_type in _package_plugins:
Expand All @@ -92,8 +92,6 @@ def register_package_plugins(map):
_default_package_plugin = DefaultDatasetForm()




def register_group_plugins(map):
"""
Register the various IGroupForm instances.
Expand Down Expand Up @@ -138,7 +136,7 @@ def register_group_plugins(map):
controller='group', action='read')
map.connect('%s_action' % group_type,
'/%s/{action}/{id}' % group_type, controller='group',
requirements=dict(action='|'.join(['edit', 'authz', 'history' ]))
requirements=dict(action='|'.join(['edit', 'authz', 'history']))
)

if group_type in _group_plugins:
Expand Down Expand Up @@ -203,7 +201,6 @@ def history_template(self):
"""
return 'package/history.html'


def package_form(self):
return 'package/new_package_form.html'

Expand All @@ -215,7 +212,7 @@ def form_to_db_schema_options(self, options):
If a context is provided, and it contains a schema, it will be
returned.
'''
schema = options.get('context',{}).get('schema',None)
schema = options.get('context', {}).get('schema', None)
if schema:
return schema

Expand Down Expand Up @@ -248,7 +245,7 @@ def db_to_form_schema_options(self, options):
If a context is provided, and it contains a schema, it will be
returned.
'''
schema = options.get('context',{}).get('schema',None)
schema = options.get('context', {}).get('schema', None)
if schema:
return schema
return self.db_to_form_schema()
Expand All @@ -273,11 +270,9 @@ def check_data_dict(self, data_dict, schema=None):
raise dictization_functions.DataError(data_dict)

def setup_template_variables(self, context, data_dict):
from pylons import config

authz_fn = logic.get_action('group_list_authz')
c.groups_authz = authz_fn(context, data_dict)
data_dict.update({'available_only':True})
data_dict.update({'available_only': True})

c.groups_available = authz_fn(context, data_dict)

Expand All @@ -300,7 +295,6 @@ def setup_template_variables(self, context, data_dict):
c.auth_for_change_state = False



class DefaultGroupForm(object):
"""
Provides a default implementation of the pluggable Group controller
Expand Down Expand Up @@ -352,7 +346,6 @@ def edit_template(self):
"""
return 'group/edit.html'


def group_form(self):
return 'group/new_group_form.html'

Expand All @@ -364,7 +357,7 @@ def form_to_db_schema_options(self, options):
If a context is provided, and it contains a schema, it will be
returned.
'''
schema = options.get('context',{}).get('schema',None)
schema = options.get('context', {}).get('schema', None)
if schema:
return schema

Expand Down Expand Up @@ -396,7 +389,7 @@ def db_to_form_schema_options(self, options):
If a context is provided, and it contains a schema, it will be
returned.
'''
schema = options.get('context',{}).get('schema',None)
schema = options.get('context', {}).get('schema', None)
if schema:
return schema
return self.db_to_form_schema()
Expand Down

0 comments on commit b838d56

Please sign in to comment.