[ckan-changes] [okfn/ckan] adfe0e: Make recently_changed_packages_activity_stream a h...

GitHub noreply at github.com
Sun Dec 2 15:34:27 UTC 2012


  Branch: refs/heads/bug-recently-changed-packages-activity-stream
  Home:   https://github.com/okfn/ckan
  Commit: adfe0e34630ec544711db96bcd20f48d061f49a0
      https://github.com/okfn/ckan/commit/adfe0e34630ec544711db96bcd20f48d061f49a0
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-12-02 (Sun, 02 Dec 2012)

  Changed paths:
    M ckan/controllers/home.py
    M ckan/lib/helpers.py

  Log Message:
  -----------
  Make recently_changed_packages_activity_stream a helper

recently_changed_packages_activity_stream was an @property of the
HomeController, but it wasn't working, accessing the property just
returned a property object e.g. <property object at 0x7f7210087e68> not
the HTML string as desired.

I think this is because the @property was declared inside a method, and
properties only work at class-level.

The @property cannot simply be moved to class level because it uses
`context`, a param of the index() function it was defined in.

Instead move recently_changed_packages_activity_stream into helpers.py,
where any template (not just the front page) can access it like this:

    {{ h.recently_changed_packages_activity_stream() }}

dashboard_activity_stream is already done the same way (but other
activity streams are not).

This means any existing home/index.html templates that were accessing
recently_changed_packages_activity_stream as an attribute of the
template context itself, will no longer work. However, apparently they
weren't working anyway.





More information about the ckan-changes mailing list