IClick support
This commit is contained in:
parent
f67777c547
commit
1b6e26f5ce
|
@ -10,8 +10,6 @@ import ckan.model as model
|
|||
|
||||
from . import dbutil
|
||||
|
||||
from ckan.cli import error_shout, click_config_option
|
||||
from ckan.cli.cli import CkanCommand
|
||||
import ckan.plugins.toolkit as tk
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
@ -22,14 +20,16 @@ RESOURCE_URL_REGEX = re.compile("/dataset/[a-z0-9-_]+/resource/([a-z0-9-_]+)")
|
|||
DATASET_EDIT_REGEX = re.compile("/dataset/edit/([a-z0-9-_]+)")
|
||||
|
||||
|
||||
@click.group(short_help=u"GoogleAnalytics commands")
|
||||
@click.help_option(u"-h", u"--help")
|
||||
@click_config_option
|
||||
@click.pass_context
|
||||
def googleanalytics(ctx, config, *args, **kwargs):
|
||||
ctx.obj = CkanCommand(config)
|
||||
def get_commands():
|
||||
return [
|
||||
googleanalytics
|
||||
]
|
||||
|
||||
|
||||
@click.group(short_help=u"GoogleAnalytics commands")
|
||||
def googleanalytics():
|
||||
pass
|
||||
|
||||
@googleanalytics.command()
|
||||
def init():
|
||||
"""Initialise the local stats database tables
|
||||
|
|
|
@ -7,10 +7,11 @@ import queue
|
|||
import ckan.plugins as plugins
|
||||
|
||||
from ckanext.googleanalytics.views import ga
|
||||
|
||||
from ckanext.googleanalytics.cli import get_commands
|
||||
|
||||
class GAMixinPlugin(plugins.SingletonPlugin):
|
||||
plugins.implements(plugins.IBlueprint)
|
||||
plugins.implements(plugins.IClick)
|
||||
|
||||
analytics_queue = queue.Queue()
|
||||
|
||||
|
@ -18,3 +19,8 @@ class GAMixinPlugin(plugins.SingletonPlugin):
|
|||
|
||||
def get_blueprint(self):
|
||||
return [ga]
|
||||
|
||||
# IClick
|
||||
|
||||
def get_commands(self):
|
||||
return get_commands()
|
||||
|
|
Loading…
Reference in New Issue