Skip to content

Commit

Permalink
PEP8ificiation
Browse files Browse the repository at this point in the history
  • Loading branch information
rossjones committed Jun 26, 2012
1 parent 6960a0f commit 0516bf5
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions ckanext/organizations/forms.py
@@ -1,4 +1,5 @@
import os, logging
import os
import logging

import ckan.authz as authz
from ckan.logic import NotAuthorized
Expand All @@ -15,8 +16,7 @@
not_empty,
empty,
ignore,
keep_extras,
)
keep_extras)

log = logging.getLogger(__name__)

Expand All @@ -42,10 +42,14 @@ class OrganizationForm(SingletonPlugin):

def before_map(self, map):
controller = 'ckanext.organizations.controllers:OrganizationController'
map.connect('/organization/users/{id}', controller=controller, action='users')
map.connect('/organization/apply/{id}', controller=controller, action='apply')
map.connect('/organization/apply', controller=controller, action='apply')
map.connect('/organization/edit/{id}', controller='group', action='edit')
map.connect('/organization/users/{id}', controller=controller,
action='users')
map.connect('/organization/apply/{id}', controller=controller,
action='apply')
map.connect('/organization/apply', controller=controller,
action='apply')
map.connect('/organization/edit/{id}', controller='group',
action='edit')
map.connect('/organization/new', controller='group', action='new')
map.connect('/organization/{id}', controller='group', action='read')
map.connect('/organization', controller='group', action='index')
Expand All @@ -64,8 +68,8 @@ def update_config(self, config):
rootdir = os.path.dirname(os.path.dirname(here))
template_dir = os.path.join(rootdir, 'ckanext',
'organizations', 'templates')
config['extra_template_paths'] = ','.join([template_dir,
config.get('extra_template_paths', '')])
config['extra_template_paths'] = ','.\
join([template_dir, config.get('extra_template_paths', '')])

# Override /group/* as the default groups urls
config['ckan.default.group_type'] = 'organization'
Expand All @@ -84,7 +88,6 @@ def index_template(self):
"""
return 'organization_index.html'


def read_template(self):
"""
Returns a string representing the location of the template to be
Expand All @@ -99,7 +102,6 @@ def history_template(self):
"""
return 'organization_history.html'


def group_form(self):
"""
Returns a string representing the location of the template to be
Expand Down Expand Up @@ -159,7 +161,7 @@ def setup_template_variables(self, context, data_dict):
"""
c.user_groups = c.userobj.get_groups('organization')
local_ctx = {'model': model, 'session': model.Session,
'user': c.user or c.author}
'user': c.user or c.author}

try:
check_access('group_create', local_ctx)
Expand All @@ -178,6 +180,7 @@ def setup_template_variables(self, context, data_dict):
c.parent = grps[0]
c.users = group.members_of_type(model.User)


class OrganizationDatasetForm(SingletonPlugin):

implements(IDatasetForm, inherit=True)
Expand Down Expand Up @@ -226,7 +229,6 @@ def history_template(self):
def package_form(self):
return 'organization_package_form.html'


def db_to_form_schema(self):
'''This is an interface to manipulate data from the database
into a format suitable for the form (optional)'''
Expand All @@ -244,9 +246,10 @@ def check_data_dict(self, data_dict, schema=None):
def setup_template_variables(self, context, data_dict):
from pylons import config

data_dict.update({'available_only':True})
data_dict.update({'available_only': True})

c.groups_available = c.userobj and c.userobj.get_groups('organization') or []
c.groups_available = c.userobj and \
c.userobj.get_groups('organization') or []
c.licences = [('', '')] + base.model.Package.get_license_options()
c.is_sysadmin = authz.Authorizer().is_sysadmin(c.user)

Expand Down

0 comments on commit 0516bf5

Please sign in to comment.