Ticket #1490 (closed enhancement: fixed)

Opened 2 years ago

Last modified 2 years ago

Standardize output from package listings coming from the logic layer

Reported by: amercader Owned by: amercader
Priority: minor Milestone: ckan-sprint-2011-12-05
Component: ckan Keywords:
Cc: johnglover, kindly Repository: ckan
Theme: dictization

Description

Right now, the two logic functions that return a list of packages (package_search [1] and group_packages_list [2])use custom functions to generate the output dict. That's suboptimal because:

  • The template function that renders the package listing (package_list_from_dict) could end up receiving different dicts.
  • Not all package properties are available at the template level (e.g extras, tags...). These can be really useful to customize the listing from an extension.

In general only the functions present in lib/dictization/model_dictize.py should be used to build the output of a logic function, in that case package_dictize. If necessary, they can be modified to include missing properties, like on this particular case the "isopen" property, needed by the template renderer.

[1] https://github.com/okfn/ckan/blob/master/ckan/logic/action/get.py#L685 [2] https://github.com/okfn/ckan/blob/master/ckan/logic/action/get.py#L442

Change History

comment:1 Changed 2 years ago by amercader

  • Status changed from new to closed
  • Resolution set to fixed

Fixed in c23821b

comment:2 Changed 2 years ago by dread

Fixed in 1.5.1

  • group_package_show introduced in 1.5.1
  • tag_show added extended packages in 1.5 (e6bad88a)
  • package_search added extended packages in 1.5 (e6bad88a)
Note: See TracTickets for help on using tickets.