{
"info": {
"author": "Benjamin Dauvergne",
"author_email": "bdauvergne@entrouvert.com",
"bugtrack_url": null,
"classifiers": [],
"description": "Settings\n========\n\nYou must declare blocks in a dictionnary setting named\nCMS_PLUGIN_BLURP_RENDERERS, each block define a name, a renderer\nclass and its configuration. The key of the dictionnary define the\nslug of each renderer instance, and the value associated to this\nslug must be a dictionnary containing at least a key called 'name'\ncontaining the human name of this instance.\n\nRenderer\n========\n\nA renderer is a class with the following interface::\n\n class Renderer(object):\n def __init__(self, slug, config):\n pass\n\n def render(self, context):\n '''Return the context to render the template'''\n pass\n\n def render_template(self):\n '''Return a template path or a Template object'''\n pass\n\nThe render method must return a context which will be passed to its\ntemplate, the render_template method must return template path or a\nDjango Template object.\n\nYou can also define the following class method::\n\n @classmethod\n def check(cls, config)\n '''Validate the config dictionnary and yield an ASCII string for each error'''\n pass\n\nYou can raise ImproperlyConfigured when the configuration does not validate.\n\nThere is two abstract helper classes:\n - `cmsplugin_blurp.renderers.base.BaseRenderer`\n which provide abstract method for checking that `render()` and\n `render_template()` are properly overriden and a generic\n `check()` method which call the `check_config()` config method\n which must return an iterator yielding strings if errors are\n found\n - `cmsplugin_blurp.renderers.template.TemplateRenderer`\n an abstract subclass of the `BaseRenderer` which provide a\n generic implementation of `render_template()` which extract the\n template path from the configuration dictionnary using the key\n `template_name` and if it is not found return a template parsed from the\n value of the key `template`.\n\nCommon configuration keys\n=========================\n\n- ``ajax`` if True this key indicate to the base plugin to render the plugin using an AJAX request.\n Requires jQuery to be loaded previously by the page using the plugin.\n\n You must add the ``cmsplugin_blurp.urls`` to your urls::\n\n ...\n url(r'^cmsplugin_blurp/', include('cmsplugin_blurp.urls')),\n ...\n\n- ``ajax_refresh`` if more than zero it indicates the time between refresh of\n the plugin content using the AJAX request otherwise the content is never\n refreshed after the first loading.\n\nStatic renderer\n===============\n\nThe simplest renderer is the static renderer you can configure one like this::\n\n CMS_PLUGIN_PLUGIN_BLURP_RENDERERS = {\n 'homepage_text': {\n 'name': u'Homepage text',\n 'class': 'cmsplugin_blurp.renderers.static.Renderer',\n 'content': u'This is the text for the homepage',\n 'template': 'homepage_text.html',\n }\n }\n\nThe template `homepage_text.html` could look like this::\n\n {{ config.content }}\n\n\nData source renderer\n====================\n\nIt load one or more local (using a `file://...` URL) or remote file (using\nan `http://...` or `https://...` URL) and parses them using the\nfollowing parsers:\n\n - a json parser using the `json` package,\n - an XML parser using the `etree.ElementTree` package,\n - a RSS parser using the `feedparser` package feedparser,\n - a CSV parser using the `csv` package.\n\nThe resulting data structure can be cached, in this case loading is\nasynchronous using a thread.\n\nThe config dictonnary can contain the following keys:\n- `name`, the human name of this renderer instance,\n- `source`, a list of dictionnary defining the remote files, the\ncontent of the dictionnary is described later,\n- `template`, the template in which to render the data sources, it\nwill receive a variable named `data_sources` in its context\ncontaining property named after the `slug` field of each source.\n\nA source definition is a dictionnary containing the following keys:\n - `slug`, the field name to hold this source parsed value in the\n template, for example with this configuration:\n\n\n ...\n 'slug': 'source1',\n ...\n\n you can access it with this template fragment:\n\n {{ data_sources.source1 }}\n\n\n - `url`, the URL of the file for this source, the scheme file://,\n http://, and https:// are supported,\n - `auth_mech`, whether an authentication mechanism is required by\n the http[s]:// URL, it can be `hmac-sha1`, `hmac-sha256` or\n `oauth2`. The HMAC mechanism is specified later; the OAuth2\n mechanisme is the classical OAuth2 HTTP bearer authentication\n mechanism but it prequires that you are using django-allauth and\n that an access token for the provider `authentic2` can be\n retrieved for the current user,\n - `signature_key`, when using the HMAC authentication mechanism it\n holds the secret key used to sign the exchanges,\n - `async`, if True make refreshing the cache asynchronous (using a thread),\n beware that if the cache is currently empty a synchronous update will be\n done, lock are used to limit update thread to one by URL, but it you use\n a worker engine their could be multiple thread trying to update the same\n cache in different workers, value is optional and its default is False,\n - `timeout`, a timeout for making the HTTP request, it is optional\n and it default to 10 seconds,\n - `refresh`, how long to cache the parsed value of the source, it\n is optional and it defaults to 3600 seconds,\n - `verify_certificate`, when the scheme of URL is https, it\n indicates whether to check the SSL certificate against configured\n certifate auhtorities, it is optional and defaults to True,\n - `allow_redirects`, whether to follow HTTP redirects when getting\n the data source file, it is optional and defaults to False,\n - `parser_type`, how to parse the loaded file, it can be `json`,\n `xml`, `rss`, 'csv' or 'raw' if you do not want any parsing to be\n done, it is optional and defaults to 'raw',\n - `content_type`, when doing an HTTP request it configures the\n content of the `Accept` header, it is optional and automatically\n set using the `parser_type` value.\n - `limit`, when parsing an RSS file it limits the returned to first\n `limit` entries sorted by date, it is optional and defaults to 0\n meaning no limit,\n - `csv_params`, when parsing a csv file this dictionnary is passed\n as keyword arguments to the `reader()` or `DictReader()`\n constructors, depending on whether the `fieldnames` arguments is\n present,\n - `user_context`, whether the user must be part of the cache key. For retro\n compatibility If authentication mechanism is OAuth2, it defaults to True\n otherwise to False.\n\nExemple with the JSON parser\n----------------------------\n\nThe configuration::\n\n CMS_PLUGIN_BLURP_RENDERERS = {\n 'json': {\n 'name': u'My JSON content',\n 'class': 'cmsplugin_blurp.renderer.data_source.Renderer',\n 'sources': [\n {\n 'slug': 'json_source',\n 'url': 'http://example.net/file.json',\n 'parser_type': 'json',\n 'auth_mech': 'hmac-sha1',\n 'signature_key': 'abcdefgh0123',\n 'refresh': 600,\n }\n ]\n 'template': 'my-json-block.html',\n }\n }\n\nThe `my-json-block.html` template::\n\n
\n {% for key, value in data_sources.json_source.iteritems %}\n - {{ key }}
\n - {{ value }}
\n {% endfor %}\n
\n\nExemple with the CSV parser\n---------------------------\n\nWe suppose that the file `/var/spool/data/timesheet.csv` contains\nthe following datas::\n\n Monday,\"10-12,14-17\"\n Tuesday,\"10-12,14-18\"\n ....\n\nYou can present this file using this configuration::\n\n CMS_PLUGIN_BLURP_RENDERERS = {\n 'timesheet': {\n 'name': u'Timesheet of our organization',\n 'class': 'cmsplugin_blurp.renderer.data_source.Renderer',\n 'sources': [\n {\n 'slug': 'timesheet',\n 'url': 'file:///var/spool/data/timesheet.csv',\n 'parser_type': 'csv',\n 'refresh': 86400,\n 'csv_params': {\n 'fieldnames': [\n 'day',\n 'opening_hours',\n ]\n }\n }\n ],\n 'template': 'timesheet.html',\n }\n }\n\nand the following template::\n\n \n \n | Day | Opening hours |
\n \n \n {% for row in data_sources.timesheet %}\n | {{ row.day }} | {{ row.opening_hours }} |
\n {% endfor %}\n \n
\n\nSQL Renderer\n============\n\nConfiguration::\n\n CMS_PLUGIN_BLURP_RENDERERS = {\n 'student_table': {\n 'name': u'Table of students',\n 'class': 'cmsplugin_blurp.renderer.sql.Renderer',\n 'url': 'postgresql://scott:tiger@localhost:5432/mydatabase',\n 'views': {\n 'students': {\n 'query': 'SELECT name, age, birthdate FROM student WHERE class_id = :class_id',\n 'bindparams': {\n 'class_id': 12\n }\n }\n }\n 'template': 'student-table.html',\n }\n }\n\nTemplate::\n\n \n \n {% for row in students %}\n \n | {{ row.name }} | \n {{ row.age }} | \n {{ row.birthdate }} | \n
\n {% endfor %}\n
\n\nTemplate tag\n============\n\nrender_blurp\n------------\n\nYou can render a block in any template using the template tag ``render_blurp``:\n\n {% load blurp_tags %}\n\n {% render_blurp \"student_table\" %}\n\nblurp block tag\n---------------\n\nYou can insert the context generated by a blurp in your current template to do\nthe templating yourself, beware that you will lose ajaxification and dynamic\nreloading if you use this tag as we cannot send your inline template to the\najax endpoint::\n\n {% load blurp_tags %}\n\n {% blurp \"student_table %}\n {% for row in students %}\n \n | {{ row.name }} | \n {{ row.age }} | \n {{ row.birthdate }} | \n
\n {% endfor %}\n {% endblurp %}",
"description_content_type": null,
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "http://dev.entrouvert.org/projects/django-cmsplugin-blurp/",
"keywords": "",
"license": "AGPLv3 or later",
"maintainer": "",
"maintainer_email": "",
"name": "django-cmsplugin-blurp",
"package_url": "https://pypi.org/project/django-cmsplugin-blurp/",
"platform": "",
"project_url": "https://pypi.org/project/django-cmsplugin-blurp/",
"project_urls": {
"Homepage": "http://dev.entrouvert.org/projects/django-cmsplugin-blurp/"
},
"release_url": "https://pypi.org/project/django-cmsplugin-blurp/1.18/",
"requires_dist": null,
"requires_python": "",
"summary": "",
"version": "1.18"
},
"last_serial": 2825886,
"releases": {
"1.0.0": [
{
"comment_text": "",
"digests": {
"md5": "bccbf9b9f7a003c5c6a64e68c949e026",
"sha256": "4a452781d12182228123b8c2e8a1a20d074624759a0ed35559e4cf78f3df3c57"
},
"downloads": -1,
"filename": "django-cmsplugin-blurp-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "bccbf9b9f7a003c5c6a64e68c949e026",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16364,
"upload_time": "2014-07-01T10:30:29",
"url": "https://files.pythonhosted.org/packages/94/94/3d4b8387d843a1e072a24f7c1c4f86fed0a5324474bf00844f7239321720/django-cmsplugin-blurp-1.0.0.tar.gz"
}
],
"1.0.3": [
{
"comment_text": "",
"digests": {
"md5": "bc087da03f3a4301ac760135eccd222e",
"sha256": "4635a27d94bf5b8349991b12b2b3ffd62df51b47e03c6bb4d054a0e136ea336f"
},
"downloads": -1,
"filename": "django-cmsplugin-blurp-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "bc087da03f3a4301ac760135eccd222e",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17165,
"upload_time": "2014-07-02T08:36:20",
"url": "https://files.pythonhosted.org/packages/5a/7b/79504f11556312759c2eb127ebb1a7b68fec54c4f030bbe168f4e62aa360/django-cmsplugin-blurp-1.0.3.tar.gz"
}
],
"1.0.4": [
{
"comment_text": "",
"digests": {
"md5": "566dadb1f4bc6a0b946cbdafec63b371",
"sha256": "5770caaaf5c87f284257c3151bdb90fbdd243cac4b896a01556ce7bd05aa0333"
},
"downloads": -1,
"filename": "django-cmsplugin-blurp-1.0.4.tar.gz",
"has_sig": false,
"md5_digest": "566dadb1f4bc6a0b946cbdafec63b371",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17340,
"upload_time": "2014-07-04T08:32:19",
"url": "https://files.pythonhosted.org/packages/73/34/e1ea53c8a92d27a80da4d8581bd486473ac61724875b995e4cead908a430/django-cmsplugin-blurp-1.0.4.tar.gz"
}
],
"1.0.5": [
{
"comment_text": "",
"digests": {
"md5": "56b81de1bcc5c0747cda3a3d5f9b95a1",
"sha256": "238207b87912b2f3fd31a2620312c813602755d8db27a093a666b3046d6a7a1f"
},
"downloads": -1,
"filename": "django-cmsplugin-blurp-1.0.5.tar.gz",
"has_sig": false,
"md5_digest": "56b81de1bcc5c0747cda3a3d5f9b95a1",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17391,
"upload_time": "2014-07-04T08:54:41",
"url": "https://files.pythonhosted.org/packages/ae/55/e1877980184e8292a1554195fd36ee811074b0628a417ee95b581e7a6ebb/django-cmsplugin-blurp-1.0.5.tar.gz"
}
],
"1.0.6": [
{
"comment_text": "",
"digests": {
"md5": "743dbf04b312550165c51ce914f5f670",
"sha256": "d073f4fd4939d9f0b4b478bdc6af8b8b7e835ef459c2c3644abcab63cc786254"
},
"downloads": -1,
"filename": "django-cmsplugin-blurp-1.0.6.tar.gz",
"has_sig": false,
"md5_digest": "743dbf04b312550165c51ce914f5f670",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 17406,
"upload_time": "2014-07-04T09:03:59",
"url": "https://files.pythonhosted.org/packages/ae/b5/f47bead28dacd5e1b1cc128a80f905b708eb60e672e040f9aadd7e48ecc1/django-cmsplugin-blurp-1.0.6.tar.gz"
}
],
"1.10.0": [
{
"comment_text": "",
"digests": {
"md5": "63dedc65bb5c2bcbeabdbce7745b4b5d",
"sha256": "9cf69582268a7798c386c0b935ac1df90f88eebc378bc485b707f46b27e1226a"
},
"downloads": -1,
"filename": "django-cmsplugin-blurp-1.10.0.tar.gz",
"has_sig": false,
"md5_digest": "63dedc65bb5c2bcbeabdbce7745b4b5d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 19192,
"upload_time": "2015-04-09T19:07:18",
"url": "https://files.pythonhosted.org/packages/0e/57/26aa267b253ff6020461cb44e152f15d62bb8c188f7eaf59b965aa573f30/django-cmsplugin-blurp-1.10.0.tar.gz"
}
],
"1.18": [
{
"comment_text": "",
"digests": {
"md5": "0d59fe67fdcb2b6ffc311b73c394aedd",
"sha256": "004de9bab7e179385f41684b006d0d80a7ccff4246138ed34fd612d2f6a1c123"
},
"downloads": -1,
"filename": "django-cmsplugin-blurp-1.18.tar.gz",
"has_sig": false,
"md5_digest": "0d59fe67fdcb2b6ffc311b73c394aedd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20851,
"upload_time": "2017-04-24T13:37:41",
"url": "https://files.pythonhosted.org/packages/52/2e/b5c9ea9932a4a473eea7c9c81359a4b89663c5230209c02da1ab520bef15/django-cmsplugin-blurp-1.18.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "0d59fe67fdcb2b6ffc311b73c394aedd",
"sha256": "004de9bab7e179385f41684b006d0d80a7ccff4246138ed34fd612d2f6a1c123"
},
"downloads": -1,
"filename": "django-cmsplugin-blurp-1.18.tar.gz",
"has_sig": false,
"md5_digest": "0d59fe67fdcb2b6ffc311b73c394aedd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20851,
"upload_time": "2017-04-24T13:37:41",
"url": "https://files.pythonhosted.org/packages/52/2e/b5c9ea9932a4a473eea7c9c81359a4b89663c5230209c02da1ab520bef15/django-cmsplugin-blurp-1.18.tar.gz"
}
]
}