diff --git a/README.rst b/README.rst index 14932f7..eb72a05 100644 --- a/README.rst +++ b/README.rst @@ -34,8 +34,7 @@ To install ckanext-rating: . /usr/lib/ckan/default/bin/activate 2. Install the ckanext-rating Python package into your virtual environment:: - - pip install ckanext-rating + pip install -e git+https://github.com/6aika/ckanext-rating.git#egg=ckanext-rating 3. Add ``rating`` to the ``ckan.plugins`` setting in your CKAN config file (by default the config file is located at diff --git a/ckanext/rating/__init__.py b/ckanext/rating/__init__.py index e69de29..2e2033b 100644 --- a/ckanext/rating/__init__.py +++ b/ckanext/rating/__init__.py @@ -0,0 +1,7 @@ +# this is a namespace package +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) diff --git a/ckanext/rating/logic/action.py b/ckanext/rating/logic/action.py index 64e2ce2..0f20b79 100644 --- a/ckanext/rating/logic/action.py +++ b/ckanext/rating/logic/action.py @@ -50,7 +50,19 @@ def rating_package_create(context, data_dict): return Rating.get_package_rating(package.id) + +@toolkit.side_effect_free def rating_package_get(context, data_dict): + ''' + Get the rating and count of ratings for a package. + + Returns a dictionary containing rating and ratings counts. + + :param package_id: the id of the package + :type package_id: string + :rtype: dictionary + + ''' package_id = data_dict.get('package_id') error = None diff --git a/setup.py b/setup.py index 83b2335..6cd1c68 100644 --- a/setup.py +++ b/setup.py @@ -55,6 +55,8 @@ setup( # simple. Or you can use find_packages(). packages=find_packages(exclude=['contrib', 'docs', 'tests*']), + namespace_packages=['ckanext', 'ckanext.rating'], + # List run-time dependencies here. These will be installed by pip when your # project is installed. For an analysis of "install_requires" vs pip's # requirements files see: