Skip to content

Commit

Permalink
reformat /ckan/ckan/controllers/organization.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jbspeakr authored and tobes committed Apr 11, 2013
1 parent 1f2cbba commit 6ebc7d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions ckan/controllers/organization.py
@@ -1,5 +1,6 @@
import ckan.controllers.group as group


class OrganizationController(group.GroupController):
''' The organization controller is pretty much just the group
controller. It has a few templates defined that are different and sets
Expand Down
16 changes: 6 additions & 10 deletions ckan/controllers/package.py
Expand Up @@ -41,6 +41,7 @@

lookup_package_plugin = ckan.lib.plugins.lookup_package_plugin


def _encode_params(params):
return [(k, v.encode('utf-8') if isinstance(v, basestring) else str(v))
for k, v in params]
Expand Down Expand Up @@ -110,7 +111,6 @@ def _guess_package_type(self, expecting_name=False):

return pt


def search(self):
from ckan.lib.search import SearchError

Expand Down Expand Up @@ -267,7 +267,6 @@ def pager_url(q=None, page=None):
limit = int(request.params.get('_%s_limit' % facet, 10))
c.search_facets_limits[facet] = limit


maintain.deprecate_context_item(
'facets',
'Use `c.search_facets` instead.')
Expand Down Expand Up @@ -331,7 +330,7 @@ def read(self, id, format='html'):
abort(400, _('Invalid revision format: %r') %
'Too many "@" symbols')

#check if package exists
# check if package exists
try:
c.pkg_dict = get_action('package_show')(context, data_dict)
c.pkg = context['package']
Expand Down Expand Up @@ -359,7 +358,7 @@ def comments(self, id):
context = {'model': model, 'session': model.Session,
'user': c.user or c.author}

#check if package exists
# check if package exists
try:
c.pkg_dict = get_action('package_show')(context, {'id': id})
c.pkg = context['package']
Expand All @@ -371,7 +370,7 @@ def comments(self, id):
# used by disqus plugin
c.current_package_id = c.pkg.id

#render the package
# render the package
package_saver.PackageSaver().render_package(c.pkg_dict)
return render(self._comments_template(package_type))

Expand Down Expand Up @@ -400,7 +399,7 @@ def history(self, id):
c.pkg_dict = get_action('package_show')(context, data_dict)
c.pkg_revisions = get_action('package_revision_list')(context,
data_dict)
#TODO: remove
# TODO: remove
# Still necessary for the authz check in group/layout.html
c.pkg = context['package']

Expand Down Expand Up @@ -543,7 +542,6 @@ def resource_edit(self, id, resource_id, data=None, errors=None,
redirect(h.url_for(controller='package', action='resource_read',
id=id, resource_id=resource_id))


context = {'model': model, 'session': model.Session,
'api_version': 3,
'user': c.user or c.author,}
Expand Down Expand Up @@ -575,8 +573,6 @@ def resource_edit(self, id, resource_id, data=None, errors=None,
'error_summary': error_summary, 'action': 'new'}
return render('package/resource_edit.html', extra_vars=vars)



def new_resource(self, id, data=None, errors=None, error_summary=None):
''' FIXME: This is a temporary action to allow styling of the
forms. '''
Expand Down Expand Up @@ -1172,7 +1168,7 @@ def resource_read(self, id, resource_id):
c.package['isopen'] = False

# TODO: find a nicer way of doing this
c.datastore_api = '%s/api/action' % config.get('ckan.site_url','').rstrip('/')
c.datastore_api = '%s/api/action' % config.get('ckan.site_url', '').rstrip('/')

c.related_count = c.pkg.related_count
return render('package/resource_read.html')
Expand Down

0 comments on commit 6ebc7d9

Please sign in to comment.