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

GitHub noreply at github.com
Tue Dec 11 10:02:15 UTC 2012


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: 1daea396bccb3ca57725aa90267ee72bce0726fd
      https://github.com/okfn/ckan/commit/1daea396bccb3ca57725aa90267ee72bce0726fd
  Author: Sean Hammond <seanhammond at lavabit.com>
  Date:   2012-12-11 (Tue, 11 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