Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[#473] merge origin/master

  • Loading branch information...
commit 68f0aeb88f00b2d7c2a7935ccb7fe5a1022f4c1b 1 parent d09cffd
@johnglover johnglover authored
Showing with 185,475 additions and 59,643 deletions.
  1. +1 −0  .pipignore
  2. +1 −1  .tx/config
  3. +192 −10 CHANGELOG.txt → CHANGELOG.rst
  4. +151 −109 CONTRIBUTING.rst
  5. +1 −1  LICENSE.txt
  6. +26 −8 README.rst
  7. +2 −1  bin/osx-postgres-mem.sh
  8. +14 −18 bin/travis-build
  9. +89 −239 ckan/config/deployment.ini_tmpl
  10. +22 −13 ckan/config/environment.py
  11. +20 −0 ckan/config/install.py
  12. +83 −80 ckan/config/routing.py
  13. +1 −1  ckan/config/who.ini
  14. +35 −23 ckan/controllers/api.py
  15. +0 −1  ckan/controllers/error.py
  16. +21 −24 ckan/controllers/feed.py
  17. +9 −13 ckan/controllers/group.py
  18. +24 −19 ckan/controllers/home.py
  19. +1 −0  ckan/controllers/organization.py
  20. +26 −46 ckan/controllers/package.py
  21. +24 −27 ckan/controllers/related.py
  22. +8 −8 ckan/controllers/revision.py
  23. +9 −9 ckan/controllers/storage.py
  24. +5 −3 ckan/controllers/tag.py
  25. +52 −25 ckan/controllers/user.py
  26. BIN  ckan/i18n/bg/LC_MESSAGES/ckan.mo
  27. +4,044 −2,131 ckan/i18n/bg/LC_MESSAGES/ckan.po
  28. BIN  ckan/i18n/ca/LC_MESSAGES/ckan.mo
  29. +4,048 −2,134 ckan/i18n/ca/LC_MESSAGES/ckan.po
  30. +2 −0  ckan/i18n/check_po_files.py
  31. +3,797 −1,906 ckan/i18n/ckan.pot
  32. BIN  ckan/i18n/cs_CZ/LC_MESSAGES/ckan.mo
  33. +4,064 −2,137 ckan/i18n/cs_CZ/LC_MESSAGES/ckan.po
  34. BIN  ckan/i18n/de/LC_MESSAGES/ckan.mo
  35. +4,171 −2,254 ckan/i18n/de/LC_MESSAGES/ckan.po
  36. BIN  ckan/i18n/dv/LC_MESSAGES/ckan.mo
  37. +6,064 −0 ckan/i18n/dv/LC_MESSAGES/ckan.po
  38. BIN  ckan/i18n/el/LC_MESSAGES/ckan.mo
  39. +4,186 −2,262 ckan/i18n/el/LC_MESSAGES/ckan.po
  40. BIN  ckan/i18n/en_GB/LC_MESSAGES/ckan.mo
  41. +6,066 −0 ckan/i18n/en_GB/LC_MESSAGES/ckan.po
  42. BIN  ckan/i18n/es/LC_MESSAGES/ckan.mo
  43. +4,172 −2,254 ckan/i18n/es/LC_MESSAGES/ckan.po
  44. BIN  ckan/i18n/es_AR/LC_MESSAGES/ckan.mo
  45. +6,064 −0 ckan/i18n/es_AR/LC_MESSAGES/ckan.po
  46. BIN  ckan/i18n/fa_IR/LC_MESSAGES/ckan.mo
  47. +6,053 −0 ckan/i18n/fa_IR/LC_MESSAGES/ckan.po
  48. BIN  ckan/i18n/fi/LC_MESSAGES/ckan.mo
  49. +4,185 −2,270 ckan/i18n/fi/LC_MESSAGES/ckan.po
  50. BIN  ckan/i18n/fr/LC_MESSAGES/ckan.mo
  51. +4,359 −2,444 ckan/i18n/fr/LC_MESSAGES/ckan.po
  52. BIN  ckan/i18n/hu/LC_MESSAGES/ckan.mo
  53. +3,996 −2,083 ckan/i18n/hu/LC_MESSAGES/ckan.po
  54. BIN  ckan/i18n/id/LC_MESSAGES/ckan.mo
  55. +6,051 −0 ckan/i18n/id/LC_MESSAGES/ckan.po
  56. BIN  ckan/i18n/is/LC_MESSAGES/ckan.mo
  57. +6,075 −0 ckan/i18n/is/LC_MESSAGES/ckan.po
  58. BIN  ckan/i18n/it/LC_MESSAGES/ckan.mo
  59. +4,101 −2,185 ckan/i18n/it/LC_MESSAGES/ckan.po
  60. BIN  ckan/i18n/ja/LC_MESSAGES/ckan.mo
  61. +4,045 −2,145 ckan/i18n/ja/LC_MESSAGES/ckan.po
  62. BIN  ckan/i18n/ko_KR/LC_MESSAGES/ckan.mo
  63. +6,054 −0 ckan/i18n/ko_KR/LC_MESSAGES/ckan.po
  64. BIN  ckan/i18n/lt/LC_MESSAGES/ckan.mo
  65. +4,596 −2,667 ckan/i18n/lt/LC_MESSAGES/ckan.po
  66. BIN  ckan/i18n/lv/LC_MESSAGES/ckan.mo
  67. +3,947 −2,020 ckan/i18n/lv/LC_MESSAGES/ckan.po
  68. BIN  ckan/i18n/my_MM/LC_MESSAGES/ckan.mo
  69. +6,050 −0 ckan/i18n/my_MM/LC_MESSAGES/ckan.po
  70. BIN  ckan/i18n/nl/LC_MESSAGES/ckan.mo
  71. +4,236 −2,321 ckan/i18n/nl/LC_MESSAGES/ckan.po
  72. BIN  ckan/i18n/no/LC_MESSAGES/ckan.mo
  73. +4,100 −2,186 ckan/i18n/no/LC_MESSAGES/ckan.po
  74. BIN  ckan/i18n/pl/LC_MESSAGES/ckan.mo
  75. +4,022 −2,095 ckan/i18n/pl/LC_MESSAGES/ckan.po
  76. BIN  ckan/i18n/pt_BR/LC_MESSAGES/ckan.mo
  77. +4,076 −2,162 ckan/i18n/pt_BR/LC_MESSAGES/ckan.po
  78. BIN  ckan/i18n/ro/LC_MESSAGES/ckan.mo
  79. +3,908 −1,981 ckan/i18n/ro/LC_MESSAGES/ckan.po
  80. BIN  ckan/i18n/ru/LC_MESSAGES/ckan.mo
  81. +4,365 −2,436 ckan/i18n/ru/LC_MESSAGES/ckan.po
  82. BIN  ckan/i18n/sk/LC_MESSAGES/ckan.mo
  83. +4,077 −2,150 ckan/i18n/sk/LC_MESSAGES/ckan.po
  84. BIN  ckan/i18n/sl/LC_MESSAGES/ckan.mo
  85. +3,922 −1,981 ckan/i18n/sl/LC_MESSAGES/ckan.po
  86. BIN  ckan/i18n/sq/LC_MESSAGES/ckan.mo
  87. +3,983 −2,070 ckan/i18n/sq/LC_MESSAGES/ckan.po
  88. BIN  ckan/i18n/sr/LC_MESSAGES/ckan.mo
  89. +4,034 −2,107 ckan/i18n/sr/LC_MESSAGES/ckan.po
  90. BIN  ckan/i18n/sr_Latn/LC_MESSAGES/ckan.mo
  91. +4,034 −2,107 ckan/i18n/sr_Latn/LC_MESSAGES/ckan.po
  92. BIN  ckan/i18n/sv/LC_MESSAGES/ckan.mo
  93. +4,043 −2,130 ckan/i18n/sv/LC_MESSAGES/ckan.po
  94. BIN  ckan/i18n/tr/LC_MESSAGES/ckan.mo
  95. +6,065 −0 ckan/i18n/tr/LC_MESSAGES/ckan.po
  96. BIN  ckan/i18n/uk_UA/LC_MESSAGES/ckan.mo
  97. +6,080 −0 ckan/i18n/uk_UA/LC_MESSAGES/ckan.po
  98. BIN  ckan/i18n/zh_CN/LC_MESSAGES/ckan.mo
  99. +6,054 −0 ckan/i18n/zh_CN/LC_MESSAGES/ckan.po
  100. BIN  ckan/i18n/zh_TW/LC_MESSAGES/ckan.mo
  101. +6,053 −0 ckan/i18n/zh_TW/LC_MESSAGES/ckan.po
  102. +43 −29 ckan/lib/activity_streams.py
  103. +2 −1  ckan/lib/alphabet_paginate.py
  104. +5 −1 ckan/lib/app_globals.py
  105. +49 −18 ckan/lib/base.py
  106. +80 −75 ckan/lib/cli.py
  107. +5 −5 ckan/lib/create_test_data.py
  108. +4 −2 ckan/lib/datapreview.py
  109. +16 −7 ckan/lib/dictization/model_dictize.py
  110. +23 −15 ckan/lib/dictization/model_save.py
  111. +3 −2 ckan/lib/email_notifications.py
  112. +2 −1  ckan/lib/formatters.py
  113. +275 −185 ckan/lib/helpers.py
  114. +8 −5 ckan/lib/mailer.py
  115. +2 −1  ckan/lib/navl/dictization_functions.py
  116. +8 −2 ckan/lib/navl/validators.py
  117. +2 −7 ckan/lib/package_saver.py
  118. +4 −1 ckan/lib/plugins.py
  119. +1 −1  ckan/lib/render.py
  120. +12 −5 ckan/lib/search/index.py
  121. +12 −12 ckan/lib/search/query.py
  122. +42 −14 ckan/logic/__init__.py
  123. +44 −18 ckan/logic/action/create.py
  124. +17 −6 ckan/logic/action/delete.py
  125. +68 −39 ckan/logic/action/get.py
  126. +61 −28 ckan/logic/action/update.py
  127. +21 −12 ckan/logic/auth/__init__.py
  128. +2 −2 ckan/logic/auth/create.py
  129. +14 −6 ckan/logic/auth/get.py
  130. +5 −1 ckan/logic/auth/update.py
  131. +32 −18 ckan/logic/converters.py
  132. +5 −3 ckan/logic/schema.py
  133. +37 −19 ckan/logic/validators.py
  134. +2 −2 ckan/migration/versions/067_turn_extras_to_strings.py
  135. +0 −95 ckan/misc.py
  136. +1 −0  ckan/model/__init__.py
  137. +2 −2 ckan/model/license.py
  138. +11 −6 ckan/model/package.py
  139. +1 −1  ckan/model/package_relationship.py
  140. +2 −1  ckan/model/tag.py
  141. +0 −55 ckan/model/test_user.py
  142. +9 −1 ckan/model/tracking.py
  143. +19 −16 ckan/new_authz.py
  144. +33 −4 ckan/plugins/interfaces.py
  145. +4 −4 ckan/plugins/toolkit.py
  146. +56 −100 ckan/public/base/css/main.css
  147. BIN  ckan/public/base/images/flags.png
  148. +6 −0 ckan/public/base/javascript/modules/autocomplete.js
  149. +10 −0 ckan/public/base/javascript/modules/basic-form.js
  150. +4 −1 ckan/public/base/javascript/modules/confirm-action.js
  151. +0 −1  ckan/public/base/javascript/tracking.js
  152. +4 −0 ckan/public/base/less/dataset.less
  153. +0 −105 ckan/public/base/less/footer.less
  154. +3 −0  ckan/public/base/less/group.less
  155. +23 −8 ckan/public/base/less/iehacks.less
  156. +1 −6 ckan/public/base/less/layout.less
  157. +0 −2  ckan/public/base/less/mixins.less
  158. +26 −0 ckan/public/base/less/prose.less
  159. +1 −2  ckan/public/base/test/index.html
  160. +3 −3 ckan/public/base/test/spec/client.spec.js
  161. +0 −7 ckan/public/base/test/spec/modules/autocomplete.spec.js
  162. +1 −1  ckan/templates/activity_streams/activity_stream_items.html
  163. +1 −1  ckan/templates/dataviewer/snippets/data_preview.html
  164. +79 −59 ckan/templates/development/primer.html
  165. +2 −0  ckan/templates/development/snippets/actions.html
  166. +24 −0 ckan/templates/development/snippets/context.html
  167. +3 −3 ckan/templates/development/snippets/facet.html
  168. +1 −1  ckan/templates/development/snippets/media_grid.html
  169. +3 −3 ckan/templates/development/snippets/nav.html
  170. +5 −8 ckan/templates/development/snippets/page_header.html
  171. +0 −8 ckan/templates/development/snippets/toolbar.html
  172. +7 −1 ckan/templates/group/about.html
  173. +3 −1 ckan/templates/group/activity_stream.html
  174. +3 −1 ckan/templates/group/admins.html
  175. +2 −0  ckan/templates/group/confirm_delete.html
  176. +2 −0  ckan/templates/group/confirm_delete_member.html
  177. +3 −1 ckan/templates/group/followers.html
  178. +12 −0 ckan/templates/group/history.html
  179. +8 −0 ckan/templates/group/index.html
  180. +5 −5 ckan/templates/group/member_new.html
  181. +3 −1 ckan/templates/group/members.html
  182. +4 −0 ckan/templates/group/read.html
  183. +1 −1  ckan/templates/group/snippets/group_item.html
  184. +12 −0 ckan/templates/group/snippets/history_revisions.html
  185. +31 −0 ckan/templates/group/snippets/revisions_table.html
  186. +8 −0 ckan/templates/header.html
  187. +1 −0  ckan/templates/home/index.html
  188. +7 −1 ckan/templates/organization/about.html
  189. +3 −1 ckan/templates/organization/activity_stream.html
  190. +3 −1 ckan/templates/organization/admins.html
  191. +3 −3 ckan/templates/organization/base_form_page.html
  192. +7 −1 ckan/templates/organization/bulk_process.html
  193. +2 −0  ckan/templates/organization/confirm_delete.html
  194. +2 −0  ckan/templates/organization/confirm_delete_member.html
  195. +2 −3 ckan/templates/organization/edit.html
  196. +10 −2 ckan/templates/organization/index.html
  197. +5 −5 ckan/templates/organization/member_new.html
  198. +1 −3 ckan/templates/organization/new.html
  199. +4 −0 ckan/templates/organization/read.html
  200. +1 −1  ckan/templates/organization/snippets/organization_item.html
  201. +3 −1 ckan/templates/package/activity.html
  202. +3 −1 ckan/templates/package/activity_stream.html
  203. +2 −0  ckan/templates/package/confirm_delete.html
  204. +2 −0  ckan/templates/package/confirm_delete_resource.html
  205. +3 −1 ckan/templates/package/followers.html
  206. +12 −0 ckan/templates/package/history.html
  207. +4 −0 ckan/templates/package/read.html
  208. +18 −17 ckan/templates/package/read_base.html
  209. +5 −1 ckan/templates/package/related_list.html
  210. +6 −6 ckan/templates/package/resource_read.html
  211. +22 −1 ckan/templates/package/search.html
  212. +2 −0  ckan/templates/package/snippets/additional_info.html
  213. +0 −2  ckan/templates/package/snippets/data_api_button.html
  214. +12 −0 ckan/templates/package/snippets/history_revisions.html
  215. +2 −0  ckan/templates/package/snippets/info.html
  216. +19 −4 ckan/templates/package/snippets/package_basic_fields.html
  217. +1 −1  ckan/templates/package/snippets/package_form.html
  218. +8 −0 ckan/templates/package/snippets/package_metadata_fields.html
  219. +11 −0 ckan/templates/package/snippets/resource_form.html
  220. +4 −0 ckan/templates/package/snippets/resources_list.html
  221. +31 −0 ckan/templates/package/snippets/revisions_table.html
  222. +15 −0 ckan/templates/package/snippets/search_form.html
  223. +2 −0  ckan/templates/related/confirm_delete.html
  224. +9 −1 ckan/templates/related/dashboard.html
  225. +1 −1  ckan/templates/related/snippets/related_item.html
  226. +1 −0  ckan/templates/revision/__init__.py
  227. +56 −0 ckan/templates/revision/diff.html
  228. +19 −0 ckan/templates/revision/list.html
  229. +94 −0 ckan/templates/revision/read.html
  230. +19 −0 ckan/templates/revision/read_base.html
  231. +33 −0 ckan/templates/revision/snippets/revisions_list.html
  232. +25 −0 ckan/templates/snippets/additional_info.html
  233. +47 −36 ckan/templates/snippets/facet_list.html
  234. +0 −2  ckan/templates/snippets/license.html
  235. +4 −2 ckan/templates/snippets/sort_by.html
  236. +7 −1 ckan/templates/tag/index.html
  237. +3 −1 ckan/templates/user/activity_stream.html
  238. +8 −0 ckan/templates/user/dashboard.html
  239. +5 −1 ckan/templates/user/followers.html
  240. +9 −1 ckan/templates/user/list.html
  241. +1 −1  ckan/templates/user/login.html
  242. +3 −1 ckan/templates/user/logout.html
  243. +3 −1 ckan/templates/user/new.html
  244. +3 −1 ckan/templates/user/perform_reset.html
  245. +5 −2 ckan/templates/user/read.html
  246. +2 −2 ckan/templates_legacy/package/new_package_form.html
  247. +1 −1  ckan/templates_legacy/package/read_core.html
  248. +3 −3 ckan/templates_legacy/package/resource_read.html
  249. +187 −165 ckan/tests/functional/api/model/test_vocabulary.py
  250. +86 −0 ckan/tests/functional/api/test_activity.py
  251. +17 −0 ckan/tests/functional/api/test_dashboard.py
  252. +2 −1  ckan/tests/functional/test_home.py
  253. +8 −12 ckan/tests/functional/test_package.py
  254. +4 −4 ckan/tests/functional/test_pagination.py
  255. +3 −46 ckan/tests/functional/test_user.py
  256. +2 −1  ckan/tests/lib/test_dictization.py
  257. +3 −3 ckan/tests/lib/test_solr_package_search.py
  258. +38 −6 ckan/tests/logic/test_action.py
  259. +13 −0 ckan/tests/logic/test_init.py
  260. +153 −48 ckan/tests/logic/test_member.py
  261. +46 −70 ckan/tests/misc/test_format_text.py
  262. +1 −1  ckan/tests/models/test_package.py
  263. +55 −0 ckan/tests/models/test_user.py
  264. +22 −0 ckan/tests/schema/test_schema.py
  265. +1,069 −0 ckan/tests/test_coding_standards.py
  266. +2 −2 ckanext/datastore/bin/set_permissions.sql
  267. +15 −9 ckanext/datastore/commands.py
  268. +44 −0 ckanext/datastore/controller.py
  269. +277 −178 ckanext/datastore/db.py
  270. +148 −43 ckanext/datastore/logic/action.py
  271. +8 −4 ckanext/datastore/logic/auth.py
  272. +121 −0 ckanext/datastore/logic/schema.py
  273. +117 −83 ckanext/datastore/plugin.py
  274. +89 −10 ckanext/datastore/tests/test_configure.py
  275. +47 −12 ckanext/datastore/tests/test_create.py
  276. +3 −8 ckanext/datastore/tests/test_delete.py
  277. +96 −0 ckanext/datastore/tests/test_dump.py
  278. +251 −45 ckanext/datastore/tests/test_search.py
  279. +0 −13 ckanext/datastore/tests/test_unit.py
  280. +7 −15 ckanext/datastore/tests/test_upsert.py
  281. +5 −0 ckanext/example_idatasetform/templates/package/snippets/package_basic_fields.html
  282. +0 −1  ckanext/example_idatasetform/templates/package/snippets/package_metadata_fields.html
  283. +0 −59 ckanext/jsonpreview/plugin.py
  284. +0 −33 ckanext/jsonpreview/theme/public/css/json.css
  285. +0 −50 ckanext/jsonpreview/theme/public/preview_json.js
  286. +0 −10 ckanext/jsonpreview/theme/public/resource.config
  287. +0 −13 ckanext/jsonpreview/theme/templates/json.html
  288. +13 −10 ckanext/pdfpreview/tests/test_preview.py
  289. +3 −3 ckanext/reclinepreview/theme/public/preview_recline.js
  290. +12 −0 ckanext/reclinepreview/theme/public/vendor/recline/recline.css
  291. +16 −9 ckanext/reclinepreview/theme/public/vendor/recline/recline.dataset.js
  292. +7 −6 ckanext/reclinepreview/theme/public/vendor/recline/recline.dataset.min.js
  293. +227 −104 ckanext/reclinepreview/theme/public/vendor/recline/recline.js
  294. +1 −1  ckanext/reclinepreview/theme/public/vendor/recline/recline.min.css
  295. +70 −45 ckanext/reclinepreview/theme/public/vendor/recline/recline.min.js
  296. +46 −37 ckanext/resourceproxy/controller.py
  297. +35 −14 ckanext/resourceproxy/tests/test_proxy.py
  298. 0  ckanext/{jsonpreview/tests → textpreview}/__init__.py
  299. +100 −0 ckanext/textpreview/plugin.py
  300. 0  ckanext/{jsonpreview → textpreview/tests}/__init__.py
Sorry, we could not display the entire diff because too many files (423) changed.
View
1  .pipignore
@@ -0,0 +1 @@
+ckan
View
2  .tx/config
@@ -1,7 +1,7 @@
[main]
host = http://www.transifex.net
-[ckan.1-8]
+[ckan.2-0]
file_filter = ckan/i18n/<lang>/LC_MESSAGES/ckan.po
source_file = ckan/i18n/ckan.pot
source_lang = en
View
202 CHANGELOG.txt → CHANGELOG.rst
@@ -1,21 +1,196 @@
-CKAN CHANGELOG
-++++++++++++++
+.. _changelog:
-v2.0
-====
+---------
+Changelog
+---------
+
+v2.0.1
+=================
+
+Bug fixes:
+ * Use IDatasetForm schema for resource_update (#897)
+ * Fixes for CKAN being run on a non-root URL (#948, #913)
+ * Fix Czech translation (#900)
+ * Allow JSON filters for datastore_search on GET requests (#917)
+ * Install vdm from the Python Package Index (#764)
+ * Allow extra parameters on Solr queries (#739)
+ * Create site user at startup if it does not exist (#952)
+
+
+v2.0 2013-05-10
+===============
+
+.. note:: Starting on v2.0, issue numbers with four digits refer to the old
+ ticketing system at http://trac.ckan.org and the ones with three digits refer
+ to GitHub issues. For example:
+
+ * #3020 is http://trac.ckan.org/ticket/3020
+ * #271 is https://github.com/okfn/ckan/issues/271
+
+ Some GitHub issues URLs will redirect to GitHub pull request pages.
+
+.. note:: v2.0 is a huge release so the changes listed here are just the
+ highlights. Bug fixes are not listed.
+
+Note: This version requires a requirements upgrade on source installations
+
+Note: This version requires a database upgrade
+
+Note: This version requires a Solr schema upgrade
+
+Organizations based authorization (see :doc:`authorization`):
+ CKAN's new "organizations" feature replaces the old authorization system
+ with a new one based on publisher organizations. It replaces the "Publisher
+ Profile and Workflow" feature from CKAN 1.X, any instances relying on it will
+ need to be updated.
+
+ * New organization-based authorization and organization of datasets
+ * Supports private datasets
+ * Publisher workflow
+ * New authorization ini file options
+
+
+New frontend (see :doc:`theming`):
+ CKAN's frontend has been completely redesigned, inside and out. There is
+ a new default theme and the template engine has moved from Genshi to
+ Jinja2. Any custom templates using Genshi will need to be updated, although
+ there is a :ref:`ckan.legacy_templates` setting to aid in the migration.
+
+ * Block-based template inheritance
+ * Custom jinja tags: {% ckan_extends %}, {% snippet %} and {% url_for %} (#2502, #2503)
+ * CSS "primer" page for theme developers
+ * We're now using LESS for CSS
+ * Scalable font icons (#2563)
+ * Social sharing buttons (google plus, facebook, twitter)
+ (this replaces the ckanext-social extension)
+ * Three-stage dataset creation form (#2501)
+ * New `paster front-end-build` command does everything needed to build the
+ frontend for a production CKAN site (runs `paster less` to compile the css
+ files, `paster minify` to minify the css and js files, etc.)
+
+Plugins & Extensions:
+ * New plugins toolkit provides a stable set of utility and helper functions
+ for CKAN plugins to depend on.
+ * The IDatasetForm plugin interface has been redesigned (note: this breaks
+ backwards-compatibility with existing IDatasetForm plugins) (#649)
+ * Many IDatasetForm bugs were fixed
+ * New example extensions in core, and better documentation for the relevant
+ plugin interfaces: example_itemplatehelpers (#447),
+ example_idatasetform (#2750), hopefully more to come in 2.1!
+ * New IFacets interface that allows to modify the facets shown on various
+ pages. (#400)
+ * The get_action() function now automatically adds 'model' and 'session' to
+ the context dict (this saves on boiler-plate code, and means plugins don't
+ have to import ckan.model in order to call get_action()) (#172)
+
+Activity Streams, Following & User Dashboard:
+ * New visual design for activity streams (#2941)
+ * Group activity streams now include activities for changes to any of the
+ group's datasets (#1664)
+ * Group activity streams now appear on group pages (previously they could
+ only be retrieved via the api)
+ * Dataset activity streams now appear on dataset pages (previously they could
+ only be retrieved via the api) (#3024)
+ * Users can now follow groups (previously you could only follow users or
+ datasets) (#3005)
+ * Activity streams and following are also supported for organizations (#505)
+ * When you're logged into CKAN, you now get a notifications count in the
+ top-right corner of the site, telling you how many new notifications you
+ have on your dashboard. Clicking on the count takes you to your dashboard
+ page to view your notifications. (#3009)
+ * Optionally, you can also receive notifications by email when you have new
+ activities on your dashboard (#1635)
+ * Infinite scrolling of activity streams (if you scroll to the bottom of a
+ an activity stream, CKAN will automatically load more activities) (#3018)
+ * Redesigned user dashboard (#3028):
+
+ - New dropdown-menu enables you to filter you dashboard activity stream to
+ show only activities from a particular user, dataset, group or
+ organization that you're following
+ - New sidebar shows previews and unfollow buttons (when the activity stream
+ is filtered)
+ * New :ref:`ckan.activity_streams_enabled` config file setting allows you to
+ disable the generation of activity streams (#654)
+
+Data Preview:
+ * PDF files preview (#2203)
+ * JSON files preview
+ * HTML pages preview (in an iframe) (#2888)
+ * New plugin extension point that allows plugins to add custom data previews
+ for different data types (#2961)
+ * Improved Recline Data Explorer previews (CSV files, Excel files..)
+ * Plain text files preview
+
+
+API:
+ * The Action API is now CKAN's default API, and the API documentation has
+ been rewritten (#357)
+
+Other highlights:
+ * CKAN now has continuous integration testing at
+ https://travis-ci.org/okfn/ckan/
+ * Dataset pages now have <link rel="alternate" type="application/rdf+xml"
+ links in the HTML headers, allows linked-data tools to find CKAN's RDF
+ rendering of a dataset's metadata (#413)
+ * CKAN's DataStore and Data API have been rewritten, and now use PostgreSQL
+ instead of elasticsearch, so there's no need to install elasticsearch
+ anymore (this feature was also back-ported to CKAN 1.8) (#2733)
+ * New Config page for sysadmins (/ckan-admin/config) enables sysadmins to set
+ the site title, tag line, logo, the intro text shown on the front page,
+ the about text shown on the /about page, select a theme, and add custom
+ CSS (#2302, #2781)
+ * New `paster color` command for creating color schemes
+ * Fanstatic integration (#2371):
+
+ - CKAN now uses Fanstatic to specify required static resource files
+ (js, css..) for web pages
+ - Enables each page to only include the static files that it needs,
+ reducing page loads
+ - Enables CKAN to use bundled and minified static files, further reducing
+ page loads
+ - CKAN's new `paster minify` command is used to create minified js and
+ css files (#2950) (also see `paster front-end-build`)
+ * CKAN will now recognise common file format strings such as
+ "application/json", "JSON", ".json" and "json" as a single file type "json"
+ (#2416)
+ * CKAN now supports internalization of strings in javascript files, the new
+ `paster trans` command is used to pull translatable strings out of
+ javascript files (#2774, #2750)
+ * convert_to/from_extras have been fixed to not add quotes around strings (#2930)
+ * Updated CKAN coding standards (#3020) and CONTRIBUTING.rst file
+ * Built-in page view counting and 'popular' badges on datasets and resources
+ There's also a paster command to export the tracking data to a csv file (#195)
+ * Updated CKAN Coding Standards and new CONTRIBUTING.rst file
+ * You can now change the sort ordering of datasets on the dataset search page
+
+Deprecated and removed:
+ * The IGenshiStreamFilter plugin interface is deprecated (#271), use the
+ ITemplateHelpers plugin interface instead
+ * The Model, Search and Util APIs are deprecated, use the Action API instead
+ * Removed restrict_template_vars config setting (#2257)
+ * Removed deprecated facet_title() template helper function, use
+ get_facet_title() instead (#2257)
+ * Removed deprecated am_authorized() template helper function, use
+ check_access() instead (#2257)
+ * Removed deprecated datetime_to_datestr() template helper function (#2257)
+
+
+v1.8.1 2013-05-10
+=================
+
+Bug fixes:
+ * Fixed possible XSS vulnerability on html input (#703)
+ * Fix unicode template 500 error (#808)
+ * Fix error on related controller
-* [#2257] Removed restrict_template_vars config setting.
-* [#2257] Removed deprecated facet_title() template helper function, use
- get_facet_title() instead.
-* [#2257] Removed deprecated am_authorized() template helper function, use
- check_access() instead.
-* [#2257] Removed deprecated datetime_to_datestr() template helper function.
v1.8 2012-10-19
===============
Note: This version requires a requirements upgrade on source installations
+
Note: This version requires a database upgrade
+
Note: This version does not require a Solr schema upgrade
Major
@@ -65,6 +240,13 @@ API changes and deprecation:
but is deprecated, and will be removed in future versions. (#2313)
+v1.7.3 2013-05-10
+=================
+
+Bug fixes:
+ * Fixed possible XSS vulnerability on html input (#703)
+
+
v1.7.2 2012-10-19
=================
View
260 CONTRIBUTING.rst
@@ -1,3 +1,9 @@
+.. External links in this file are done manually instead of using Sphinx stuff
+ like :doc:, :ref:, toctree etc. because GitHub also renders this file as
+ reStructuredText when it shows its "guidelines for contributing" link when
+ you make a new issue or pull request, and Sphinx things like toctree don't
+ work there. See: https://github.com/blog/1184-contributing-guidelines
+
====================
Contributing to CKAN
====================
@@ -5,47 +11,63 @@ Contributing to CKAN
.. _CKAN repo on GitHub: https://github.com/okfn/ckan
.. _CKAN issue tracker: https://github.com/okfn/ckan/issues
.. _docs.ckan.org: http://docs.ckan.org
-.. _Contributing to CKAN's Documentation: https://github.com/okfn/ckan/blob/master/CONTRIBUTING.rst#contributing-to-ckans-documentation
-(This section is about contributing code, if you want to contribute
-documentation see `Contributing to CKAN's Documentation`_.)
+CKAN is free open source software and code contributions are welcome, whether
+they're bug reports, source code, documentation or translations. The sections
+below will walk you through our processes for making different kinds of
+contributions to CKAN.
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+----------------
+Reporting Issues
+----------------
-CKAN is a free software project and code contributions are welcome. To
-contribute code to CKAN you should fork CKAN to your own GitHub account, push
-your code to a feature branch on your fork, then make a pull request for your
-branch on the central CKAN repo. We'll go through each step in detail below...
+If you've found a bug in CKAN, open a new issue on CKAN's `GitHub Issues`_ (try
+searching first to see if there's already an issue for your bug).
+.. _GitHub Issues: https://github.com/okfn/ckan/issues
-Fork CKAN on GitHub
--------------------
+----------------
+Translating CKAN
+----------------
-If you don't have access to the central `CKAN repo on GitHub`_ you should sign
-up for a free account on `GitHub.com <https://github.com/>`_ and
-`fork CKAN <https://help.github.com/articles/fork-a-repo>`_, so that you have somewhere to publish your CKAN code.
+For contributing translations to CKAN, see
+`Translating CKAN <http://docs.ckan.org/en/latest/i18n.html>`_.
-You can now clone your CKAN fork to your development machine, create a new
-branch to commit your code on, and push your branch to your CKAN fork on GitHub
-to share your code with others.
+.. toctree::
+ :hidden:
+ i18n
-Feature Branches
+
+----------------
+Coding Standards
----------------
-Work for a feature or bug fix should be developed on a feature or bug branch
-forked from master. Each individual feature or bug fix should be developed on
-its own branch. The name of the branch should include the ticket number (if
-this work has a ticket in the `CKAN issue tracker`_), the branch type
-("feature" or "bug"), and a brief one-line synopsis of the purpose of the
-ticket, for example::
+When writing code for CKAN, try to respect our coding standards:
+
+.. toctree::
+ :hidden:
- 2298-feature-add-sort-by-controls-to-search-page
- 1518-bug-upload-file-with-spaces
+ ckan-coding-standards
+ python-coding-standards
+ html-coding-standards
+ css-coding-standards
+ javascript-coding-standards
-Naming branches this way makes it easy to search for a branch by its ticket
-number using GitHub's web interface.
+* `CKAN Coding Standards <http://docs.ckan.org/en/latest/ckan-coding-standards.html>`_
+* `Python Coding Standards <http://docs.ckan.org/en/latest/python-coding-standards.html>`_
+* `HTML Coding Standards <http://docs.ckan.org/en/latest/html-coding-standards.html>`_
+* `CSS Coding Standards <http://docs.ckan.org/en/latest/css-coding-standards.html>`_
+* `JavaScript Coding Standards <http://docs.ckan.org/en/latest/javascript-coding-standards.html>`_
+---------------
Commit Messages
---------------
@@ -65,130 +87,150 @@ Generally, follow the `commit guidelines from the Pro Git book`_:
.. _commit guidelines from the Pro Git book: http://git-scm.com/book/en/Distributed-Git-Contributing-to-a-Project#Commit-Guidelines
-If your commit has a ticket in the `CKAN issue tracker`_ put the ticket number
+If your commit has an issue in the `CKAN issue tracker`_ put the issue number
at the start of the first line of the commit message like this: ``[#123]``.
This makes the CKAN release manager's job much easier!
-Here is an example CKAN commit message::
+Here's an example of a good CKAN commit message::
[#2505] Update source install instructions
Following feedback from markw (see #2406).
-Keeping Up with master
-----------------------
-When developing on a branch you should periodically pull the latest commits
-from the master branch of the central CKAN repo into your feature branch, to
-prevent the two branches from diverging from each other too much and becoming
-difficult to merge.
-If you haven't already, add the central repo to your development repo as a
-remote::
+-------------------------------
+Frontend Development Guidelines
+-------------------------------
- git remote add central git://github.com/okfn/ckan.git
- git fetch central
+.. toctree::
+ :hidden:
-Now, every now and then pull the latest commits from the central master branch
-into your feature branch. While on your feature branch, do::
+ frontend-development
+ templating
+ resources
+ template-tutorial
+ template-blocks
+ javascript-module-tutorial
- git pull central master
+* `Frontend Development <http://docs.ckan.org/en/latest/frontend-development.html>`_
+* `Templating <http://docs.ckan.org/en/latest/templating.html>`_
+* `Resources <http://docs.ckan.org/en/latest/resources.html>`_
+* `Template Tutorial <http://docs.ckan.org/en/latest/template-tutorial.html>`_
+* `Template Blocks <http://docs.ckan.org/en/latest/template-blocks.html>`_
+* `JavaScript Module Tutorial <http://docs.ckan.org/en/latest/javascript-module-tutorial.html>`_
-Pull Requests & Code Review
----------------------------
+---------------------
+Writing Documentation
+---------------------
-.. _create a pull request on GitHub: https://help.github.com/articles/creating-a-pull-request
+The quickest and easiest way to contribute documentation to CKAN is to sign up
+for a free GitHub account and simply edit the `CKAN Wiki <https://github.com/okfn/ckan/wiki>`_.
+Docs started on the wiki can make it onto `docs.ckan.org`_ later.
-Once your work on a branch is complete and is ready to be merged into the
-master branch, `create a pull request on GitHub`_. A member of the CKAN team
-will review your code and provide feedback on the pull request page. The
-reviewer may ask you to make some changes to your code. Once the pull request
-has passed the code review, the reviewer will merge your code into the master
-branch and it will become part of CKAN!
+**Tip**: Use the reStructuredText markup format when creating a wiki page,
+since reStructuredText is the format that docs.ckan.org uses, this will make
+moving the documentation from the wiki into docs.ckan.org later easier.
-When submitting a pull request:
+For how to contribute to the offical CKAN documentation at docs.ckan.org, see
+the `documentation guidelines <http://docs.ckan.org/en/latest/documentation-guidelines.html>`_.
-- Your branch should contain code for one feature or bug fix only,
- see `Feature Branches`_.
-- Your branch should contain new or changed tests for any new or changed
- code.
-- Your branch should contain updates to the
- `CHANGELOG file <https://github.com/okfn/ckan/blob/master/CHANGELOG.txt>`_
- briefly summarising your code changes.
-- Your branch should contain new or updated documentation for any new or
- updated code, see `Contributing to CKAN's Documentation`_.
-- Your branch should be up to date with the master branch of the central
- CKAN repo, see `Keeping Up with master`_.
-- All the CKAN tests should pass on your branch, see
- `Testing for Developers <http://docs.ckan.org/en/latest/test.html>`_.
+.. toctree::
+ :hidden:
+ documentation-guidelines
-Merging
--------
-When merging a feature or bug branch into master:
+.. _making a pull request:
-- Use the ``--no-ff`` option in the ``git merge`` command,
+---------------------
+Making a Pull Request
+---------------------
+Once you've written some CKAN code or documentation, you can submit it for
+review and merge into the central CKAN git repository by making a pull request.
+This section will walk you through the steps for making a pull request.
-Coding Standards
-----------------
-When writing code for CKAN, try to follow our
-`coding standards <http://docs.ckan.org/en/latest/#for-ckan-developers>`_.
+#. Create a git branch
+
+ Each logically separate piece of work (e.g. a new feature, a bug fix, a new
+ docs page, or a set of improvements to a docs page) should be developed on
+ its own branch forked from the master branch.
+
+ The name of the branch should include the issue number (if this work has an
+ issue in the `CKAN issue tracker`_), the branch type (e.g. "feature" or
+ "bug"), and a brief one-line synopsis of the work, for example::
+
+ 2298-feature-add-sort-by-controls-to-search-page
+ 1518-bug-upload-file-with-spaces
+
+
+#. Fork CKAN on GitHub
+
+ Sign up for a free account on GitHub and
+ `fork CKAN <https://help.github.com/articles/fork-a-repo>`_, so that you
+ have somewhere to publish your work.
+ Add your CKAN fork to your local CKAN git repo as a git remote. Replace
+ ``USERNAME`` with your GitHub username::
-====================================
-Contributing to CKAN's Documentation
-====================================
+ git remote add my_fork https://github.com/USERNAME/ckan
-Note: getting started with contributing to `docs.ckan.org`_ is a little
-complicated. An easier way to contribute documentation to CKAN is to
-contribute to the `CKAN Wiki <https://github.com/okfn/ckan/wiki>`_. Docs
-started on the wiki can make it onto `docs.ckan.org`_ later.
-`docs.ckan.org`_ is created using `Sphinx <http://sphinx-doc.org/>`_. The
-source files are in
-`the doc directory of the CKAN git repo <https://github.com/okfn/ckan/tree/master/doc>`_.
-To edit these docs:
+#. Commit and push your changes
-1. If you haven't already, create a
- `Python virtual environment <http://pypi.python.org/pypi/virtualenv>`_
- (virtualenv), activate it and clone the CKAN git repo into it. In this
- example we'll create a virtualenv in a folder called ``pyenv``::
+ Commit your changes on your feature branch, and push your branch to GitHub.
+ For example, make sure you're currently on your feature branch then run
+ these commands::
- virtualenv --no-site-packages pyenv
- . pyenv/bin/activate
- pip install -e 'git+https://github.com/okfn/ckan.git#egg=ckan'
+ git add doc/my_new_feature.rst
+ git commit -m "Add docs for my new feature"
+ git push my_fork my_branch
-2. Install the Python dependencies necessary for building the CKAN docs into
- your virtualenv::
+ When writing your git commit messages, try to follow the `Commit Messages`_
+ guidelines.
- pip install -r pyenv/src/ckan/pip-requirements-docs.txt
-3. Fetch the git submodule that contains CKAN's custom Sphinx theme::
+#. Send a pull request
- cd pyenv/src/ckan
- git submodule init
- git submodule update
+ Once your work on a branch is complete and is ready to be merged into the
+ master branch, `create a pull request on GitHub`_. A member of the CKAN
+ team will review your work and provide feedback on the pull request page.
+ The reviewer may ask you to make some changes. Once your pull request has
+ passed the review, the reviewer will merge your code into the master branch
+ and it will become part of CKAN!
- Note: you may occassionally have to run ``git submodule update`` again,
- when someone updates the submodule.
+ When submitting a pull request:
-4. Make changes to the documentation by using your text editor to edit the
- ``pyenv/src/ckan/doc/*.rst`` files.
+ - Your branch should contain one logically separate piece of work, and not
+ any unrelated changes.
-5. Build the documentation locally, to preview your changes::
+ - You should have good commit messages, see `Commit Messages`_.
- python setup.py build_sphinx
+ - Your branch should contain new or changed tests for any new or changed
+ code, and all the CKAN tests should pass on your branch, see
+ `Testing CKAN <http://docs.ckan.org/en/latest/test.html>`_.
- Now you can open the built HTML files in
- ``pyenv/src/ckan/build/sphinx/html`` to see your changes, e.g.:
- ``firefox pyenv/src/ckan/build/sphinx/html/index.html``.
+ - Your branch should contain new or updated documentation for any new or
+ updated code, see `Writing Documentation`_.
-6. Finally, when you're ready to submit your contributions to the CKAN
- project, follow the same process as for contributing code, see
- `Contributing to CKAN`_.
+ - Your branch should be up to date with the master branch of the central
+ CKAN repo, so pull the central master branch into your feature branch
+ before submitting your pull request.
+ For long-running feature branches, it's a good idea to pull master into
+ the feature branch periodically so that the two branches don't diverge too
+ much.
+
+.. _create a pull request on GitHub: https://help.github.com/articles/creating-a-pull-request
+
+
+Merging a Pull Request
+======================
+
+If you're reviewing a pull request for CKAN, when merging a branch into master:
+
+- Use the ``--no-ff`` option in the ``git merge`` command,
View
2  LICENSE.txt
@@ -22,7 +22,7 @@ Note
====
CKAN is sometimes packaged directly with other software (listed in
-pip-requirements.txt, pip-requirements-test.txt and pip-requirements-docs.txt).
+requirements.txt and dev-requirements.txt).
In these cases, we are required to list the licenses of the packaged softare
too. They are all AGPL compatible and read as follows in the next sections.
View
34 README.rst
@@ -18,14 +18,21 @@ Installation
See the `CKAN Documentation <http://docs.ckan.org>`_ for installation instructions.
-Community
----------
+Support
+-------
-* Developer mailing list: `ckan-dev@lists.okfn.org <http://lists.okfn.org/mailman/listinfo/ckan-dev>`_
-* Developer IRC channel: `#ckan on irc.freenode.net <http://webchat.freenode.net/?channels=ckan>`_
-* `Issue tracker <https://github.com/okfn/ckan/issues>`_
-* `CKAN tag on StackOverflow <http://stackoverflow.com/questions/tagged/ckan>`_
-* `Wiki <https://github.com/okfn/ckan/wiki>`_
+If you need help with CKAN or want to ask a question about CKAN, use either the
+`ckan-discuss`_ mailing list or the `CKAN tag on Stack Overflow`_ (try
+searching the Stack Overflow and ckan-discuss archives for an answer to your
+question first).
+
+If you've found a bug in CKAN, open a new issue on CKAN's `GitHub Issues`_ (try
+searching first to see if there's already an issue for your bug).
+
+
+.. _CKAN tag on Stack Overflow: http://stackoverflow.com/questions/tagged/ckan
+.. _ckan-discuss: http://lists.okfn.org/mailman/listinfo/ckan-discuss
+.. _GitHub Issues: https://github.com/okfn/ckan/issues
Contributing to CKAN
@@ -34,11 +41,22 @@ Contributing to CKAN
For contributing to CKAN or its documentation, see
`CONTRIBUTING <https://github.com/okfn/ckan/blob/master/CONTRIBUTING.rst>`_.
+If you want to talk about CKAN development say hi to the CKAN developers on the
+`ckan-dev`_ mailing list or in the `#ckan`_ IRC channel on irc.freenode.net.
+
+If you've figured out how to do something with CKAN and want to document it for
+others, make a new page on the `CKAN wiki`_, and tell us about it on
+`ckan-dev`_.
+
+.. _ckan-dev: http://lists.okfn.org/mailman/listinfo/ckan-dev
+.. _#ckan: http://webchat.freenode.net/?channels=ckan
+.. _CKAN Wiki: https://github.com/okfn/ckan/wiki
+
Copying and License
-------------------
-This material is copyright (c) 2006-2011 Open Knowledge Foundation.
+This material is copyright (c) 2006-2013 Open Knowledge Foundation.
It is open and licensed under the GNU Affero General Public License (AGPL) v3.0
whose full text may be found at:
View
3  bin/osx-postgres-mem.sh
@@ -13,7 +13,8 @@ case $1 in
${PGCTL} -D ${PGDATA} init
${PGCTL} -D ${PGDATA} start
sleep 2;
- psql -c "CREATE DATABASE ckantest;" postgres
+ psql -c "CREATE DATABASE ckan_dev;" postgres
+ psql -c "CREATE DATABASE ckan_test;" postgres
;;
stop)
## stop postgres
View
32 bin/travis-build
@@ -15,41 +15,37 @@ sudo add-apt-repository -yy ppa:pitti/postgresql
sudo apt-get update -qq
sudo apt-get install solr-jetty postgresql-$PGVERSION
-# Don't require a password to access DB
-sudo sed -i -e 's/ident/trust/g' /etc/postgresql/$PGVERSION/main/pg_hba.conf
-
sudo service postgresql reload
-pip install -r pip-requirements.txt --use-mirrors
-pip install -r pip-requirements-test.txt --use-mirrors
+# Setup postgres' users and databases
+sudo -u postgres psql -c "CREATE USER ckan_default WITH PASSWORD 'pass';"
+sudo -u postgres psql -c "CREATE USER datastore_default WITH PASSWORD 'pass';"
+sudo -u postgres psql -c 'CREATE DATABASE ckan_test WITH OWNER ckan_default;'
+sudo -u postgres psql -c 'CREATE DATABASE datastore_test WITH OWNER ckan_default;'
-psql -c 'CREATE DATABASE ckantest;' -U postgres
-psql -c 'CREATE DATABASE datastore;' -U postgres
+pip install -r requirements.txt -r dev-requirements.txt --use-mirrors
python setup.py develop
-# Configure CKAN's configuration file
-paster make-config ckan development.ini --no-interactive
-sed -i -e 's/.*solr_url.*/solr_url = http:\/\/127.0.0.1:8983\/solr/' development.ini
-sed -i -e 's/.*ckan\.site_id.*/ckan.site_id = travis_ci/' development.ini
-sed -i -e 's/^sqlalchemy.url.*/sqlalchemy.url = postgresql:\/\/postgres@\/ckantest/' development.ini
-sed -i -e 's/.*datastore.write_url.*/ckan.datastore.write_url = postgresql:\/\/postgres@\/datastore/' development.ini
-
# Configure Solr
echo "NO_START=0\nJETTY_HOST=127.0.0.1\nJETTY_PORT=8983\nJAVA_HOME=$JAVA_HOME" | sudo tee /etc/default/jetty
+# FIXME the solr schema cannot be hardcoded as it is dependent on the ckan version
sudo cp ckan/config/solr/schema-2.0.xml /etc/solr/conf/schema.xml
sudo service jetty restart
-paster --plugin=ckan db init
+paster db init -c test-core.ini
# If Postgres >= 9.0, we don't need to use datastore's legacy mode.
if [ $PGVERSION != '8.4' ]
then
- psql -c 'CREATE USER readonlyuser;' -U postgres
- sed -i -e 's/.*datastore.read_url.*/ckan.datastore.read_url = postgresql:\/\/readonlyuser@\/datastore/' development.ini
- paster datastore set-permissions postgres
+ psql -c 'CREATE USER datastore_default;' -U postgres
+ sed -i -e 's/.*datastore.read_url.*/ckan.datastore.read_url = postgresql:\/\/datastore_default@\/datastore_test/' test-core.ini
+ paster datastore set-permissions postgres -c test-core.ini
+else
+ sed -i -e 's/.*datastore.read_url.*//' test-core.ini
fi
+cat test-core.ini
# And finally, run the tests
nosetests --ckan --with-pylons=test-core.ini --nologcapture ckan ckanext
View
328 ckan/config/deployment.ini_tmpl
@@ -1,41 +1,21 @@
#
-# ckan - Pylons configuration
+# CKAN - Pylons configuration
+#
+# These are some of the configuration options available for your CKAN
+# instance. Check the documentation in 'doc/configuration.rst' or at the
+# following URL for a description of what they do and the full list of
+# available options:
+#
+# http://docs.ckan.org/en/${doc_version}/configuration.html
#
# The %(here)s variable will be replaced with the parent directory of this file
#
+
[DEFAULT]
-# Change debug to true when doing CKAN development, it enables Pylons'
-# interactive debugging tool, makes Fanstatic serve unminified JS and CSS
-# files, and enables CKAN templates' debugging features.
-#
# WARNING: *THIS SETTING MUST BE SET TO FALSE ON A PRODUCTION ENVIRONMENT*
-# Debug mode will enable the interactive debugging tool, allowing ANYONE to
-# execute malicious code after an exception is raised.
debug = false
-email_to = you@yourdomain.com
-error_email_from = paste@localhost
-
-# The SMTP server to connect to when sending emails to users, with optional
-# port (default: 25). For example: lavabit.com, or smtp.gmail.com:587. To
-# connect to a local sendmail process enter 'localhost'.
-smtp.server = localhost
-
-# Whether or not to use STARTTLS when connecting to the SMTP server.
-smtp.starttls = False
-
-# The username and password to use to authenticate with the SMTP server.
-# Optional, if these are left commented-out then CKAN will try to send email
-# to the SMTP server without logging in first.
-#smtp.user = your_username@gmail.com
-#smtp.password = your_password
-
-# The email address that emails sent by CKAN to users should appear to come
-# from. Optional (default: None, note that the SMTP server may insert its own
-# from address).
-#smtp.mail_from =
-
[server:main]
use = egg:Paste#http
host = 0.0.0.0
@@ -44,282 +24,158 @@ port = 5000
[app:main]
use = egg:ckan
full_stack = true
-cache_dir = %(here)s/data
+cache_dir = /tmp/%(ckan.site_id)s/
beaker.session.key = ckan
-beaker.session.secret = ${app_instance_secret}
-app_instance_uuid = ${app_instance_uuid}
-# List the names of CKAN extensions to activate.
-# Note: This line is required to be here for packaging, even if it is empty.
-# Note: Add ``pdf_preview`` to enable the resource preview for PDFs
-# Add the ``resource_proxy`` plugin to enable resorce proxying and get around the same origin policy
-# Add ``datastore`` to enable the CKAN DataStore extension
-ckan.plugins = stats json_preview recline_preview
-
-# If you'd like to fine-tune the individual locations of the cache data dirs
-# for the Cache data, or the Session saves, un-comment the desired settings
-# here:
-#beaker.cache.data_dir = %(here)s/data/cache
-#beaker.session.data_dir = %(here)s/data/sessions
-
-# Specify the database for SQLAlchemy to use:
-# * Postgres is currently required for a production CKAN deployment
-# * Sqlite (memory or file) can be used as a quick alternative for testing
-sqlalchemy.url = postgresql://ckanuser:pass@localhost/ckantest
-#sqlalchemy.url = sqlite:///
-#sqlalchemy.url = sqlite:///%(here)s/somedb.db
+# This is the secret token that the beaker library uses to hash the cookie sent
+# to the client. `paster make-config` generates a unique value for this each
+# time it generates a config file.
+beaker.session.secret = ${app_instance_secret}
-# Un-comment and specify the URLs for the DataStore database.
-# * Postgres is required
-#ckan.datastore.write_url = postgresql://ckanuser:pass@localhost/datastore
-#ckan.datastore.read_url = postgresql://readonlyuser:pass@localhost/datastore
+# `paster make-config` generates a unique value for this each time it generates
+# a config file.
+app_instance_uuid = ${app_instance_uuid}
# repoze.who config
who.config_file = %(here)s/who.ini
who.log_level = warning
who.log_file = %(cache_dir)s/who_log.ini
-# Location of RDF versions of datasets
-#rdf_packages = http://semantic.ckan.net/record/
-# Location of licenses group (defaults to cached local version of ckan group)
-#licenses_group_url = http://licenses.opendefinition.org/licenses/groups/ckan.json
+## Database Settings
+sqlalchemy.url = postgresql://ckan_default:pass@localhost/ckan_default
+#sqlalchemy.url = sqlite:///
+#sqlalchemy.url = sqlite:///%(here)s/somedb.db
-# Dataset form to use
-package_form = standard
+#ckan.datastore.write_url = postgresql://ckan_default:pass@localhost/datastore_default
+#ckan.datastore.read_url = postgresql://datastore_default:pass@localhost/datastore_default
-# Hide certain extras fields from dataset read form:
-# package_hide_extras = for_search_index_only
-# API configuration
-#apikey_header_name = X-CKAN-API-Key
+## Site Settings
-## extra places to look for templates and public files (comma separated lists)
-## any templates/files found will override correspondingly named ones in
-## ckan/templates/ and ckan/public
-## (e.g. to override main layout template layout.html or add extra css files)
-# extra_template_paths = %(here)s/my-templates
-# extra_public_paths = %(here)s/my-public
+ckan.site_url =
-# Dataset form integration
-#package_edit_return_url = http://another.frontend/dataset/<NAME>
-#package_new_return_url = http://another.frontend/dataset/<NAME>
+## Authorization Settings
-# Turn on messaging with carrot, default to false
-#ckan.async_notifier = true
-# Messaging module used by carrot:
-# * pyamqplib - AMQP (e.g. for RabbitMQ)
-# * queue - native Python Queue (debugging and tests only)
-#carrot_messaging_library = pyamqplib
+ckan.auth.anon_create_dataset = false
+ckan.auth.create_unowned_dataset = true
+ckan.auth.create_dataset_if_not_in_organization = true
+ckan.auth.user_create_groups = true
+ckan.auth.user_create_organizations = true
+ckan.auth.user_delete_groups = true
+ckan.auth.user_delete_organizations = true
+ckan.auth.create_user_via_api = false
-## Perform search just using database (rather than use e.g. solr).
-## In this setup search is crude and limited .e.g no full-text search, no faceting ...
-## However, very useful for getting up and running quickly with CKAN
-# ckan.simple_search = 1
-## Title of site (using in several places including templates and <title> tag
-ckan.site_title = CKAN
+## Search Settings
-## Logo image to use on the home page
-ckan.site_logo = /base/images/ckan-logo.png
+ckan.site_id = default
+#solr_url = http://127.0.0.1:8983/solr
-## Site tagline / description (used on front page)
-ckan.site_description = DataSuite
+#ckan.simple_search = 1
-## Used in creating some absolute urls (such as rss feeds, css files) and
-## dump filenames
-ckan.site_url =
-## Favicon (default is the CKAN software favicon)
-ckan.favicon = /images/icons/ckan.ico
+## Plugins Settings
+
+# Note: Add ``datastore`` to enable the CKAN DataStore
+# Add ``pdf_preview`` to enable the resource preview for PDFs
+# Add ``resource_proxy`` to enable resorce proxying and get around the
+# same origin policy
+ckan.plugins = stats text_preview recline_preview
-## The gravatar default to use. This can be any of the pre-defined strings
-## as defined on http://en.gravatar.com/site/implement/images/ (e.g. "identicon"
-## or "mm"). Or it can be a url, e.g. "http://example.com/images/avatar.jpg"
+
+## Front-End Settings
+ckan.site_title = CKAN
+ckan.site_logo = /base/images/ckan-logo.png
+ckan.site_description =
+ckan.favicon = /images/icons/ckan.ico
ckan.gravatar_default = identicon
+ckan.preview.direct = png jpg gif
+ckan.preview.loadable = html htm rdf+xml owl+xml xml n3 n-triples turtle plain atom csv tsv rss txt json
+
+# package_hide_extras = for_search_index_only
+#package_edit_return_url = http://another.frontend/dataset/<NAME>
+#package_new_return_url = http://another.frontend/dataset/<NAME>
+#ckan.recaptcha.publickey =
+#ckan.recaptcha.privatekey =
+#licenses_group_url = http://licenses.opendefinition.org/licenses/groups/ckan.json
+# ckan.template_footer_end =
-## Solr support
-#solr_url = http://127.0.0.1:8983/solr
-## Automatic indexing. Make all changes immediately available via the search
-## after editing or creating a dataset. Default is true. If for some reason
-## you need the indexing to occur asynchronously, set this option to 0.
-# ckan.search.automatic_indexing = 1
-
-## An 'id' for the site (using, for example, when creating entries in a common search index)
-## If not specified derived from the site_url
-# ckan.site_id = ckan.net
-
-## API url to use (e.g. in AJAX callbacks)
-## Enable if the API is at a different domain
-# ckan.api_url = http://www.ckan.net
-
-## html content to be inserted just before </head> tag (e.g. extra stylesheet)
-## NB: can use html e.g. <strong>blah</strong>
-## NB: can have multiline strings just indent following lines
-# ckan.template_head_end = <link rel="stylesheet" href="http://mysite.org/css/custom.css" type="text/css">
-
-## html content to be inserted just before </body> tag (e.g. google analytics code)
-## NB: can use html e.g. <strong>blah</strong>
-## NB: can have multiline strings just indent following lines
-# ckan.template_footer_end =
-
-# These three settings (ckan.log_dir, ckan.dump_dir and ckan.backup_dir) are
-# all used in cron jobs, not in CKAN itself. CKAN logging is configured
-# in the logging configuration below
-# Directory for logs (produced by cron scripts associated with ckan)
-ckan.log_dir = %(here)s/log
-# Directory for JSON/CSV dumps (must match setting in apache config)
-ckan.dump_dir = %(here)s/dump
-# Directory for SQL database backups
-ckan.backup_dir = %(here)s/backup
-
-# Default authorizations for new domain objects
-#ckan.default_roles.Package = {"visitor": ["reader"], "logged_in": ["reader"]}
-#ckan.default_roles.Group = {"visitor": ["reader"], "logged_in": ["reader"]}
-#ckan.default_roles.System = {"visitor": ["reader"], "logged_in": ["editor"]}
-#ckan.default_roles.AuthorizationGroup = {"visitor": ["reader"], "logged_in": ["reader"]}
-
-## Ckan public and private recaptcha keys [localhost]
-#ckan.recaptcha.publickey =
-#ckan.recaptcha.privatekey =
-
-# Locale/languages
+## Internationalisation Settings
ckan.locale_default = en
-#ckan.locales_offered =
-# Languages are grouped by percentage of strings in CKAN 1.8 translated
-# (those with 100% first, then those with >=80%, then >=50%, then <50%) and
-# within these groups roughly sorted by number of worldwide native speakers
-# according to Wikipedia.
ckan.locale_order = en pt_BR ja it cs_CZ ca es fr el sv sr sr@latin no sk fi ru de pl nl bg ko_KR hu sa sl lv
-ckan.locales_filtered_out =
+ckan.locales_offered =
+ckan.locales_filtered_out =
-## Atom Feeds
-#
-# Settings for customising the metadata provided in
-# atom feeds.
-#
-# These settings are used to generate the <id> tags for both feeds
-# and entries. The unique <id>s are created following the method
-# outlined in http://www.taguri.org/ ie - they generate tagURIs, as specified
-# in http://tools.ietf.org/html/rfc4151#section-2.1 :
-#
-# <id>tag:thedatahub.org,2012:/feeds/group/933f3857-79fd-4beb-a835-c0349e31ce76</id>
-#
-# Each component has the corresponding settings:
-#
-# "thedatahub.org" is ckan.feeds.authority_name
-# "2012" is ckan.feeds.date
-#
-# Leave blank to use the ckan.site_url config value, otherwise set to a
-# domain or email address that you own. e.g. thedatahub.org or
-# admin@thedatahub.org
-ckan.feeds.authority_name =
-
-# Pick a date of the form "yyyy[-mm[-dd]]" during which the above domain was
-# owned by you.
-ckan.feeds.date = 2012
+## Feeds Settings
-# If not set, then the value in `ckan.site_id` is used.
+ckan.feeds.authority_name =
+ckan.feeds.date =
ckan.feeds.author_name =
-
-# If not set, then the value in `ckan.site_url` is used.
ckan.feeds.author_link =
-## File Store
-#
-# CKAN allows users to upload files directly to file storage either on the local
-# file system or to online ‘cloud’ storage like Amazon S3 or Google Storage.
-#
-# If you are using local file storage, remember to set ckan.site_url.
-#
-# To enable cloud storage (Google or S3), first run: pip install boto
-#
-# @see http://docs.ckan.org/en/latest/filestore.html
-
-# 'Bucket' to use for file storage
-#ckan.storage.bucket = my-bucket-name
+## Storage Settings
-# To enable local file storage:
+# Local file storage:
#ofs.impl = pairtree
-#ofs.storage_dir = /my/path/to/storage/root/directory
+#ofs.storage_dir = /var/lib/ckan/default
-# To enable Google cloud storage:
+# Google cloud storage:
#ofs.impl = google
#ofs.gs_access_key_id =
#ofs.gs_secret_access_key =
-# To enable S3 cloud storage:
+# S3 cloud storage:
#ofs.impl = s3
#ofs.aws_access_key_id = ....
#ofs.aws_secret_access_key = ....
-## Previews
-#
-# Set the file types that should be previewed inline (e.g. images) or directly in an iframe.
+## Activity Streams Settings
-ckan.preview.direct = png jpg gif
-ckan.preview.loadable = html htm rdf+xml owl+xml xml n3 n-triples turtle plain atom csv tsv rss txt json
-
-
-# Activity Streams
-#
-# Default maximum number of activities to show in an activity stream.
-# ckan.activity_list_limit = 31
-
-
-# Activity Streams Email Notifications
-#
-# Uncomment this line to enable activity streams email notifications.
-# You also need to setup a cron job to send the emails, see the documentation.
-#ckan.activity_streams_email_notifications = True
-
-# Email notifications for events older than this time delta will not be sent.
-# Accepted formats: '2 days', '14 days', '4:35:00' (hours, minutes, seconds),
-# '7 days, 3:23:34', etc.
+#ckan.activity_streams_enabled = true
+#ckan.activity_list_limit = 31
+#ckan.activity_streams_email_notifications = true
# ckan.email_notifications_since = 2 days
-# DEBUGGING
-
-# ckan.debug_supress_header This option can be set to suppress the debug
-# information showing the controller and action recieving the request being
-# shown in the header. Note: This info only shows if debug is set to true.
-ckan.debug_supress_header = false
+## Email settings
-## ===================================
-## Extensions
+email_to = you@yourdomain.com
+error_email_from = paste@localhost
+smtp.server = localhost
+smtp.starttls = False
+#smtp.user = your_username@gmail.com
+#smtp.password = your_password
+#smtp.mail_from =
-## Config option to enable the (1 day) cache for stats
-## Default (if not defined) is True as stats computations are intensive
-# ckanext.stats.cache_enabled = True
-# Logging configuration
+## Logging configuration
[loggers]
keys = root, ckan, ckanext
[handlers]
-keys = console, file
+keys = console
[formatters]
keys = generic
[logger_root]
level = WARNING
-handlers = console, file
+handlers = console
[logger_ckan]
level = INFO
-handlers = console, file
+handlers = console
qualname = ckan
propagate = 0
[logger_ckanext]
level = DEBUG
-handlers = console, file
+handlers = console
qualname = ckanext
propagate = 0
@@ -329,11 +185,5 @@ args = (sys.stderr,)
level = NOTSET
formatter = generic
-[handler_file]
-class = logging.handlers.RotatingFileHandler
-formatter = generic
-level = NOTSET
-args = ("ckan.log", "a", 20000000, 9)
-
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s] %(message)s
View
35 ckan/config/environment.py
@@ -9,7 +9,6 @@
from paste.deploy.converters import asbool
import sqlalchemy
from pylons import config
-from pylons.i18n import _, ungettext
from genshi.template import TemplateLoader
from genshi.filters.i18n import Translator
@@ -18,10 +17,13 @@
import ckan.plugins as p
import ckan.lib.helpers as h
import ckan.lib.app_globals as app_globals
+import ckan.lib.jinja_extensions as jinja_extensions
+import ckan.logic as logic
+
+from ckan.common import _, ungettext
log = logging.getLogger(__name__)
-import lib.jinja_extensions
# Suppress benign warning 'Unbuilt egg for setuptools'
warnings.simplefilter('ignore', UserWarning)
@@ -297,22 +299,22 @@ def genshi_lookup_attr(cls, obj, key):
# Create Jinja2 environment
- env = lib.jinja_extensions.Environment(
- loader=lib.jinja_extensions.CkanFileSystemLoader(template_paths),
+ env = jinja_extensions.Environment(
+ loader=jinja_extensions.CkanFileSystemLoader(template_paths),
autoescape=True,
extensions=['jinja2.ext.do', 'jinja2.ext.with_',
- lib.jinja_extensions.SnippetExtension,
- lib.jinja_extensions.CkanExtend,
- lib.jinja_extensions.CkanInternationalizationExtension,
- lib.jinja_extensions.LinkForExtension,
- lib.jinja_extensions.ResourceExtension,
- lib.jinja_extensions.UrlForStaticExtension,
- lib.jinja_extensions.UrlForExtension]
+ jinja_extensions.SnippetExtension,
+ jinja_extensions.CkanExtend,
+ jinja_extensions.CkanInternationalizationExtension,
+ jinja_extensions.LinkForExtension,
+ jinja_extensions.ResourceExtension,
+ jinja_extensions.UrlForStaticExtension,
+ jinja_extensions.UrlForExtension]
)
env.install_gettext_callables(_, ungettext, newstyle=True)
# custom filters
- env.filters['empty_and_escape'] = lib.jinja_extensions.empty_and_escape
- env.filters['truncate'] = lib.jinja_extensions.truncate
+ env.filters['empty_and_escape'] = jinja_extensions.empty_and_escape
+ env.filters['truncate'] = jinja_extensions.truncate
config['pylons.app_globals'].jinja_env = env
# CONFIGURATION OPTIONS HERE (note: all config options will override
@@ -347,3 +349,10 @@ def genshi_lookup_attr(cls, obj, key):
for plugin in p.PluginImplementations(p.IConfigurable):
plugin.configure(config)
+
+ # Here we create the site user if they are not already in the database
+ try:
+ logic.get_action('get_site_user')({'ignore_auth': True}, None)
+ except sqlalchemy.exc.ProgrammingError:
+ # The database is not initialised. This is a bit dirty.
+ pass
View
20 ckan/config/install.py
@@ -0,0 +1,20 @@
+import re
+
+from pylons.util import PylonsInstaller
+
+import ckan
+
+
+class CKANInstaller(PylonsInstaller):
+
+ def config_content(self, command, vars):
+ ckan_version = ckan.__version__
+ ckan_base_version = re.sub('[^0-9\.]', '', ckan_version)
+ if ckan_base_version == ckan_version:
+ ckan_doc_version = 'ckan-{0}'.format(ckan_version)
+ else:
+ ckan_doc_version = 'latest'
+
+ vars.setdefault('doc_version', ckan_doc_version)
+
+ return super(CKANInstaller, self).config_content(command, vars)
View
163 ckan/config/routing.py
@@ -69,14 +69,13 @@ def make_map():
# import controllers here rather than at root level because
# pylons config is initialised by this point.
-
# Helpers to reduce code clutter
GET = dict(method=['GET'])
PUT = dict(method=['PUT'])
POST = dict(method=['POST'])
DELETE = dict(method=['DELETE'])
GET_POST = dict(method=['GET', 'POST'])
- PUT_POST = dict(method=['PUT','POST'])
+ PUT_POST = dict(method=['PUT', 'POST'])
PUT_POST_DELETE = dict(method=['PUT', 'POST', 'DELETE'])
OPTIONS = dict(method=['OPTIONS'])
@@ -93,7 +92,8 @@ def make_map():
map.connect('/error/{action}', controller='error')
map.connect('/error/{action}/{id}', controller='error')
- map.connect('*url', controller='home', action='cors_options', conditions=OPTIONS)
+ map.connect('*url', controller='home', action='cors_options',
+ conditions=OPTIONS)
# CUSTOM ROUTES HERE
for plugin in routing_plugins:
@@ -104,39 +104,43 @@ def make_map():
# CKAN API versioned.
register_list = [
- 'package',
- 'dataset',
- 'resource',
- 'tag',
- 'group',
- 'related',
- 'revision',
- 'licenses',
- 'rating',
- 'user',
- 'activity'
- ]
+ 'package',
+ 'dataset',
+ 'resource',
+ 'tag',
+ 'group',
+ 'related',
+ 'revision',
+ 'licenses',
+ 'rating',
+ 'user',
+ 'activity'
+ ]
register_list_str = '|'.join(register_list)
# /api ver 3 or none
- with SubMapper(map, controller='api', path_prefix='/api{ver:/3|}', ver='/3') as m:
+ with SubMapper(map, controller='api', path_prefix='/api{ver:/3|}',
+ ver='/3') as m:
m.connect('/action/{logic_function}', action='action',
conditions=GET_POST)
# /api ver 1, 2, 3 or none
- with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|/3|}', ver='/1') as m:
+ with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|/3|}',
+ ver='/1') as m:
m.connect('', action='get_api')
m.connect('/search/{register}', action='search')
# /api ver 1, 2 or none
- with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|}', ver='/1') as m:
+ with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|}',
+ ver='/1') as m:
m.connect('/tag_counts', action='tag_counts')
m.connect('/rest', action='index')
m.connect('/qos/throughput/', action='throughput', conditions=GET)
# /api/rest ver 1, 2 or none
- with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|}', ver='/1',
- requirements=dict(register=register_list_str)) as m:
+ with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|}',
+ ver='/1', requirements=dict(register=register_list_str)
+ ) as m:
m.connect('/rest/{register}', action='list', conditions=GET)
m.connect('/rest/{register}', action='create', conditions=POST)
@@ -145,20 +149,21 @@ def make_map():
m.connect('/rest/{register}/{id}', action='update', conditions=POST)
m.connect('/rest/{register}/{id}', action='delete', conditions=DELETE)
m.connect('/rest/{register}/{id}/:subregister', action='list',
- conditions=GET)
+ conditions=GET)
m.connect('/rest/{register}/{id}/:subregister', action='create',
- conditions=POST)
+ conditions=POST)
m.connect('/rest/{register}/{id}/:subregister/{id2}', action='create',
- conditions=POST)
+ conditions=POST)
m.connect('/rest/{register}/{id}/:subregister/{id2}', action='show',
- conditions=GET)
+ conditions=GET)
m.connect('/rest/{register}/{id}/:subregister/{id2}', action='update',
- conditions=PUT)
+ conditions=PUT)
m.connect('/rest/{register}/{id}/:subregister/{id2}', action='delete',
- conditions=DELETE)
+ conditions=DELETE)
# /api/util ver 1, 2 or none
- with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|}', ver='/1') as m:
+ with SubMapper(map, controller='api', path_prefix='/api{ver:/1|/2|}',
+ ver='/1') as m:
m.connect('/util/user/autocomplete', action='user_autocomplete')
m.connect('/util/is_slug_valid', action='is_slug_valid',
conditions=GET)
@@ -190,7 +195,7 @@ def make_map():
map.redirect('/package/{url:.*}', '/dataset/{url}')
with SubMapper(map, controller='related') as m:
- m.connect('related_new', '/dataset/{id}/related/new', action='new')
+ m.connect('related_new', '/dataset/{id}/related/new', action='new')
m.connect('related_edit', '/dataset/{id}/related/edit/{related_id}',
action='edit')
m.connect('related_delete', '/dataset/{id}/related/delete/{related_id}',
@@ -205,35 +210,32 @@ def make_map():
highlight_actions='index search')
m.connect('add dataset', '/dataset/new', action='new')
m.connect('/dataset/{action}',
- requirements=dict(action='|'.join([
- 'list',
- 'autocomplete',
- 'search'
- ]))
- )
+ requirements=dict(action='|'.join([
+ 'list',
+ 'autocomplete',
+ 'search'
+ ])))
m.connect('/dataset/{action}/{id}/{revision}', action='read_ajax',
- requirements=dict(action='|'.join([
- 'read',
- 'edit',
- 'history',
- ]))
- )
+ requirements=dict(action='|'.join([
+ 'read',
+ 'edit',
+ 'history',
+ ])))
m.connect('/dataset/{action}/{id}',
- requirements=dict(action='|'.join([
- 'edit',
- 'new_metadata',
- 'new_resource',
- 'history',
- 'read_ajax',
- 'history_ajax',
- 'follow',
- 'activity',
- 'unfollow',
- 'delete',
- 'api_data',
- ]))
- )
+ requirements=dict(action='|'.join([
+ 'edit',
+ 'new_metadata',
+ 'new_resource',
+ 'history',
+ 'read_ajax',
+ 'history_ajax',
+ 'follow',
+ 'activity',
+ 'unfollow',
+ 'delete',
+ 'api_data',
+ ])))
m.connect('dataset_followers', '/dataset/followers/{id}',
action='followers', ckan_icon='group')
m.connect('dataset_activity', '/dataset/activity/{id}',
@@ -253,7 +255,8 @@ def make_map():
m.connect('/dataset/{id}/resource/{resource_id}/embed',
action='resource_embedded_dataviewer')
m.connect('/dataset/{id}/resource/{resource_id}/viewer',
- action='resource_embedded_dataviewer', width="960", height="800")
+ action='resource_embedded_dataviewer', width="960",
+ height="800")
m.connect('/dataset/{id}/resource/{resource_id}/preview',
action='resource_datapreview')
@@ -271,22 +274,21 @@ def make_map():
m.connect('group_index', '/group', action='index',
highlight_actions='index search')
m.connect('group_list', '/group/list', action='list')
- m.connect('group_new', '/group/new', action='new')
+ m.connect('group_new', '/group/new', action='new')
m.connect('group_action', '/group/{action}/{id}',
- requirements=dict(action='|'.join([
- 'edit',
- 'delete',
- 'members',
- 'member_new',
- 'member_delete',
- 'history',
- 'followers',
- 'follow',
- 'unfollow',
- 'admins',
- 'activity',
- ]))
- )
+ requirements=dict(action='|'.join([
+ 'edit',
+ 'delete',
+ 'members',
+ 'member_new',
+ 'member_delete',
+ 'history',
+ 'followers',
+ 'follow',
+ 'unfollow',
+ 'admins',
+ 'activity',
+ ])))
m.connect('group_about', '/group/about/{id}', action='about',
ckan_icon='info-sign'),
m.connect('group_activity', '/group/activity/{id}/{offset}',
@@ -300,14 +302,13 @@ def make_map():
m.connect('/organization/list', action='list')
m.connect('/organization/new', action='new')
m.connect('/organization/{action}/{id}',
- requirements=dict(action='|'.join([
- 'delete',
- 'admins',
- 'member_new',
- 'member_delete',
- 'history'
- ]))
- )
+ requirements=dict(action='|'.join([
+ 'delete',
+ 'admins',
+ 'member_new',
+ 'member_delete',
+ 'history'
+ ])))
m.connect('organization_activity', '/organization/activity/{id}',
action='activity', ckan_icon='time')
m.connect('organization_read', '/organization/{id}', action='read')
@@ -319,7 +320,8 @@ def make_map():
action='edit', ckan_icon='edit')
m.connect('organization_members', '/organization/members/{id}',
action='members', ckan_icon='group')
- m.connect('organization_bulk_process', '/organization/bulk_process/{id}',
+ m.connect('organization_bulk_process',
+ '/organization/bulk_process/{id}',
action='bulk_process', ckan_icon='sitemap')
register_package_plugins(map)
register_group_plugins(map)
@@ -327,7 +329,8 @@ def make_map():
# tags
map.redirect('/tags', '/tag')
map.redirect('/tags/{url:.*}', '/tag/{url}')
- map.redirect('/tag/read/{url:.*}', '/tag/{url}', _redirect_code='301 Moved Permanently')
+ map.redirect('/tag/read/{url:.*}', '/tag/{url}',
+ _redirect_code='301 Moved Permanently')
map.connect('/tag', controller='tag', action='index')
map.connect('/tag/{id}', controller='tag', action='read')
# users
View
2  ckan/config/who.ini
@@ -18,7 +18,7 @@ post_logout_url = /user/logged_out
[plugin:openid]
use = repoze.who.plugins.openid:make_identification_plugin
store = file
-store_file_path = %(here)s/sstore
+store_file_path = /tmp/sstore
#openid_field = openid
openid_field = openid_identifier
came_from_field = came_from
View
58 ckan/controllers/api.py
@@ -5,12 +5,9 @@
import glob
import urllib
-from pylons import c, request, response
-from pylons.i18n import _, gettext
-from paste.util.multidict import MultiDict
from webob.multidict import UnicodeMultiDict
+from paste.util.multidict import MultiDict
-import ckan.rating
import ckan.model as model
import ckan.logic as logic
import ckan.lib.base as base
@@ -20,6 +17,8 @@
import ckan.lib.jsonp as jsonp
import ckan.lib.munge as munge
+from ckan.common import _, c, request, response
+
log = logging.getLogger(__name__)
@@ -159,7 +158,7 @@ def action(self, logic_function, ver=None):
except KeyError:
log.error('Can\'t find logic function: %s' % logic_function)
return self._finish_bad_request(
- gettext('Action name not known: %s') % str(logic_function))
+ _('Action name not known: %s') % str(logic_function))
context = {'model': model, 'session': model.Session, 'user': c.user,
'api_version': ver}
@@ -172,14 +171,17 @@ def action(self, logic_function, ver=None):
except ValueError, inst:
log.error('Bad request data: %s' % str(inst))
return self._finish_bad_request(
- gettext('JSON Error: %s') % str(inst))
+ _('JSON Error: %s') % str(inst))
if not isinstance(request_data, dict):
# this occurs if request_data is blank
log.error('Bad request data - not dict: %r' % request_data)
return self._finish_bad_request(
- gettext('Bad request data: %s') %
+ _('Bad request data: %s') %
'Request data JSON decoded to %r but '
'it needs to be a dictionary.' % request_data)
+ # if callback is specified we do not want to send that to the search
+ if 'callback' in request_data:
+ del request_data['callback']
try:
result = function(context, request_data)
return_dict['success'] = True
@@ -247,7 +249,7 @@ def list(self, ver=None, register=None, subregister=None, id=None):
'dataset': 'package_list',
'tag': 'tag_list',
'related': 'related_list',
- 'licenses': 'licence_list',
+ 'licenses': 'license_list',
('dataset', 'relationships'): 'package_relationships_list',
('dataset', 'revisions'): 'package_revision_list',
('dataset', 'activity'): 'package_activity_list',
@@ -260,7 +262,7 @@ def list(self, ver=None, register=None, subregister=None, id=None):
action = self._get_action_from_map(action_map, register, subregister)
if not action:
return self._finish_bad_request(
- gettext('Cannot list entity of this type: %s') % register)
+ _('Cannot list entity of this type: %s') % register)
try:
return self._finish_ok(action(context, {'id': id}))
except NotFound, e:
@@ -291,7 +293,7 @@ def show(self, ver=None, register=None, subregister=None,
action = self._get_action_from_map(action_map, register, subregister)
if not action:
return self._finish_bad_request(
- gettext('Cannot read entity of this type: %s') % register)
+ _('Cannot read entity of this type: %s') % register)
try:
return self._finish_ok(action(context, data_dict))
except NotFound, e:
@@ -326,12 +328,12 @@ def create(self, ver=None, register=None, subregister=None,
data_dict.update(request_data)
except ValueError, inst:
return self._finish_bad_request(
- gettext('JSON Error: %s') % str(inst))
+ _('JSON Error: %s') % str(inst))
action = self._get_action_from_map(action_map, register, subregister)
if not action:
return self._finish_bad_request(
- gettext('Cannot create new entity of this type: %s %s') %
+ _('Cannot create new entity of this type: %s %s') %
(register, subregister))
try:
@@ -388,12 +390,12 @@ def update(self, ver=None, register=None, subregister=None,
data_dict.update(request_data)
except ValueError, inst:
return self._finish_bad_request(
- gettext('JSON Error: %s') % str(inst))
+ _('JSON Error: %s') % str(inst))
action = self._get_action_from_map(action_map, register, subregister)
if not action:
return self._finish_bad_request(
- gettext('Cannot update entity of this type: %s') %
+ _('Cannot update entity of this type: %s') %
register.encode('utf-8'))
try:
response_data = action(context, data_dict)
@@ -440,7 +442,7 @@ def delete(self, ver=None, register=None, subregister=None,
action = self._get_action_from_map(action_map, register, subregister)
if not action:
return self._finish_bad_request(
- gettext('Cannot delete entity of this type: %s %s') %
+ _('Cannot delete entity of this type: %s %s') %
(register, subregister or ''))
try:
response_data = action(context, data_dict)
@@ -463,11 +465,11 @@ def search(self, ver=None, register=None):
id = request.params['since_id']
if not id:
return self._finish_bad_request(
- gettext(u'No revision specified'))
+ _(u'No revision specified'))
rev = model.Session.query(model.Revision).get(id)
if rev is None:
return self._finish_not_found(
- gettext(u'There is no revision with id: %s') % id)
+ _(u'There is no revision with id: %s') % id)
since_time = rev.timestamp
elif 'since_time' in request.params:
since_time_str = request.params['since_time']
@@ -477,7 +479,7 @@ def search(self, ver=None, register=None):
return self._finish_bad_request('ValueError: %s' % inst)
else:
return self._finish_bad_request(
- gettext("Missing search term ('since_id=UUID' or " +
+ _("Missing search term ('since_id=UUID' or " +
" 'since_time=TIMESTAMP')"))
revs = model.Session.query(model.Revision).\
filter(model.Revision.timestamp > since_time)
@@ -487,7 +489,7 @@ def search(self, ver=None, register=None):
params = MultiDict(self._get_search_params(request.params))
except ValueError, e:
return self._finish_bad_request(
- gettext('Could not read parameters: %r' % e))
+ _('Could not read parameters: %r' % e))
# if using API v2, default to returning the package ID if
# no field list is specified
@@ -533,15 +535,25 @@ def search(self, ver=None, register=None):
params = search.\
convert_legacy_parameters_to_solr(params)
query = search.query_for(model.Package)
+
+ # Remove any existing fq param and set the capacity to
+ # public
+ if 'fq' in params:
+ del params['fq']
+ params['fq'] = '+capacity:public'
+ # if callback is specified we do not want to send that to
+ # the search
+ if 'callback' in params:
+ del params['callback']
results = query.run(params)
return self._finish_ok(results)
except search.SearchError, e:
log.exception(e)
return self._finish_bad_request(
- gettext('Bad search option: %s') % e)
+ _('Bad search option: %s') % e)
else:
return self._finish_not_found(
- gettext('Unknown register: %s') % register)
+ _('Unknown register: %s') % register)
@classmethod
def _get_search_params(cls, request_params):
@@ -550,7 +562,7 @@ def _get_search_params(cls, request_params):
qjson_param = request_params['qjson'].replace('\\\\u', '\\u')
params = h.json.loads(qjson_param, encoding='utf8')
except ValueError, e:
- raise ValueError(gettext('Malformed qjson value') + ': %r'
+ raise ValueError(_('Malformed qjson value: %r')
% e)
elif len(request_params) == 1 and \
len(request_params.values()[0]) < 2 and \
@@ -567,7 +579,7 @@ def _get_search_params(cls, request_params):
def markdown(self, ver=None):
raw_markdown = request.params.get('q', '')
- results = ckan.misc.MarkdownFormat().to_html(raw_markdown)
+ results = h.render_markdown(raw_markdown)
return self._finish_ok(results)
View
1  ckan/controllers/error.py
@@ -10,7 +10,6 @@
class ErrorController(BaseController):
-
"""Generates error documents as and when they are required.
The ErrorDocuments middleware forwards to ErrorController when error
View
45 ckan/controllers/feed.py
@@ -21,16 +21,17 @@
# TODO fix imports
import logging
import urlparse
+from urllib import urlencode
import webhelpers.feedgenerator
from pylons import config
-from pylons.i18n import _
-from urllib import urlencode
-from ckan import model
-from ckan.lib.base import BaseController, c, request, response, json, abort, g
+import ckan.model as model
+import ckan.lib.base as base
import ckan.lib.helpers as h
-from ckan.logic import get_action, NotFound
+import ckan.logic as logic
+
+from ckan.common import _, g, c, request, response, json
# TODO make the item list configurable
ITEMS_LIMIT = 20
@@ -55,7 +56,7 @@ def _package_search(data_dict):
data_dict['rows'] = ITEMS_LIMIT
# package_search action modifies the data_dict, so keep our copy intact.
- query = get_action('package_search')(context, data_dict.copy())
+ query = logic.get_action('package_search')(context, data_dict.copy())
return query[