{
"info": {
"author": "AXANT",
"author_email": "tech@axant.it",
"bugtrack_url": null,
"classifiers": [],
"description": "About activitystream\n--------------------\n\nactivitystream is a Pluggable application for TurboGears2 for create a simple activity stream.\n\nThe activity stream is intended to be used as base layer for a **notification** system\n\nCurrently this pluggable works only with **ming** fell free to submit a pull request with *sqlalchemy* support\n\nInstalling\n----------\n\nactivitystream can be installed both from pypi or from github::\n\n pip install activitystream\n\nshould just work for most of the users\n\nPlugging activitystream\n-----------------------\n\nIn your application *config/app_cfg.py* import **plug**::\n\n from tgext.pluggable import plug\n\nThen at the *end of the file* call plug with activitystream::\n\n plug(base_config, 'activitystream')\n\n\nActionManager\n-------------\n\nWhen you want to create an activity you should do something like::\n\n from activitystream import ActionManager\n am = ActionManager()\n\n activity = am.create(\n actor=model.User.query.find().all()[0],\n verb='created',\n target=model.Post.query.find().all()[0],\n recipients=model.User.query.find().all()[1:3],\n )\n\nThen you may want to notify the activity to the recipients.\nIt's up to you to choose how to dispatch them.\n\nFields Explanation\n-------------------\n\n- **actor**: reference to who is creating the activity\n- **verb**: a string describing the action itself, for example 'created' or 'updated'\n- **action_obj**: reference to ... I don't know\n- **target**: reference to the subject of the activity\n- **timestamp**: datetime of the creation of the activity\n- **description**: string with a description of the activity\n- **extra**: string that you can use for example to store a json with extra informations\n- **recipients**: list of references to who is expected to receive\n a notification from this activity. references can be of different entities.\n\nNot Seen (counter of unread notifications)\n------------------------------------------\n\nAdd in your recipient model (probably your User model)::\n\n from datetime import datetime\n last_activity_seen = FieldProperty(s.DateTime, if_missing=datetime.utcnow())\n\nthen you can get the latest 10 notifications of a recipient with::\n\n recipient = model.User.query.find().all()[1]\n actions = am.get_by_recipient(recipient).limit(10).all()\n # and if you want a counter of unread notifications call\n count = am.count_not_seen_by_recipient(recipient)\n # you can check if the recipient have seen a notification with\n not_seen = actions[0].timestamp > recipient.last_activity_seen\n # don't forget to update your recipient when him reads his notifications\n recipient.last_activity_seen = datetime.utcnow()\n\nExposed Controllers\n-------------------\n\nif you don't like your urls to start with activitystream just ``plug`` with a new app_id\n\n- **/activitystream/ajax_update_last_seen_of_a_recipient**: call this through ajax with ``_type``\n and ``_id`` of the recipient to update ``last_activity_seen``.\n should return a json with the last_activity_seen before the update\n\n- **/activitystream/see**: updates ``last_activity_seen`` of the logged in user\n and redirects to the given ``target_link``\n\nNotifications Rendering\n-----------------------\n\nThis is up to you. I suggest to use ``tg.render_template`` with ``tg_cache``\n\nadding in ``myproject.lib.helpers``::\n\n from activitystream import am\n from tg import render_template\n def notification_cache(n):\n return {\n 'cache_key': n._id, # this is really important\n 'cache_expire': 604800, # a week\n 'cache_type': 'memory',\n }\n\n\nand in the template where you want your notifications to being displayed::\n\n \n ${h.render_template(\n {'n': n, 'tg_cache': h.notification_cache(n)},\n 'kajiki',\n 'myproject.templates.notification'\n )}
\n \n\nmeanwhile your ``myproject.templates.notification`` may look like::\n\n \n
\n \n
${n.actor.display_name} ${_(n.verb)}
${n.target}\n
${n.timestamp_since}
\n
\n \n\nif your notification needs to be rendered differently based on the recipient then you have to use\nanother caching strategy\n",
"description_content_type": "",
"docs_url": null,
"download_url": "",
"downloads": {
"last_day": -1,
"last_month": -1,
"last_week": -1
},
"home_page": "https://github.com/axant/tgapp-activitystream",
"keywords": "turbogears2.application",
"license": "",
"maintainer": "",
"maintainer_email": "",
"name": "tgapp-activitystream",
"package_url": "https://pypi.org/project/tgapp-activitystream/",
"platform": "",
"project_url": "https://pypi.org/project/tgapp-activitystream/",
"project_urls": {
"Homepage": "https://github.com/axant/tgapp-activitystream"
},
"release_url": "https://pypi.org/project/tgapp-activitystream/0.1.1/",
"requires_dist": null,
"requires_python": "",
"summary": "Pluggable for create a simple activity stream.",
"version": "0.1.1"
},
"last_serial": 5356120,
"releases": {
"0.0.1": [
{
"comment_text": "",
"digests": {
"md5": "129cac7d2ea1b538e9719f9de89289c9",
"sha256": "649884f149e498cc6d72ebbebbbc3eac69313061cbe2316193f0bdfd65ffe4ff"
},
"downloads": -1,
"filename": "tgapp-activitystream-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "129cac7d2ea1b538e9719f9de89289c9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8829,
"upload_time": "2016-09-06T15:25:17",
"url": "https://files.pythonhosted.org/packages/e5/0f/42a0504b402704f23751b238d769e24d7c95b6008cc91f3136ffb5d523c0/tgapp-activitystream-0.0.1.tar.gz"
}
],
"0.0.2": [
{
"comment_text": "",
"digests": {
"md5": "9c9f00a0d9c56949bf910215960861e9",
"sha256": "de7b3c455f9e2b1d571896229f934b504a9532077185e323e2c5faae9ce993a4"
},
"downloads": -1,
"filename": "tgapp-activitystream-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "9c9f00a0d9c56949bf910215960861e9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10200,
"upload_time": "2016-09-07T14:34:57",
"url": "https://files.pythonhosted.org/packages/bb/44/c989e4b9cdb3a475d76b2fd4143951e6cab0e03bd5af802fa965fe2eff4d/tgapp-activitystream-0.0.2.tar.gz"
}
],
"0.0.3": [
{
"comment_text": "",
"digests": {
"md5": "c40bda679fae73c7c4b1512ad32bd5fb",
"sha256": "1756a11ef6e83a48d82300c64783a014be308dff998974ff4b7ea9797c238525"
},
"downloads": -1,
"filename": "tgapp-activitystream-0.0.3.tar.gz",
"has_sig": false,
"md5_digest": "c40bda679fae73c7c4b1512ad32bd5fb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 10220,
"upload_time": "2016-09-16T09:33:59",
"url": "https://files.pythonhosted.org/packages/0f/e3/f9868b9748abd0fbbcfb08e64ea85a448f48b4847e21ea817dcdcf466717/tgapp-activitystream-0.0.3.tar.gz"
}
],
"0.1.0": [
{
"comment_text": "",
"digests": {
"md5": "1ee6820700f6f898d4f58189c5fc1a3f",
"sha256": "b79bab21e03925d2ad0dc80449534f09aee2f4f7d5fef11556b506c2efe43116"
},
"downloads": -1,
"filename": "tgapp-activitystream-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "1ee6820700f6f898d4f58189c5fc1a3f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13726,
"upload_time": "2018-03-22T21:36:19",
"url": "https://files.pythonhosted.org/packages/c0/c3/5f70677c3be935b3edd6d1e161772db360701219618d52d16c981b677a0b/tgapp-activitystream-0.1.0.tar.gz"
}
],
"0.1.1": [
{
"comment_text": "",
"digests": {
"md5": "f63a4acd2ea4a100ac6dbe20b00c5077",
"sha256": "2c1c20449480bcce919efac77d6ec1b3ffafa6598290292fe770e5ee9a3b7531"
},
"downloads": -1,
"filename": "tgapp-activitystream-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f63a4acd2ea4a100ac6dbe20b00c5077",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13717,
"upload_time": "2019-06-04T07:53:45",
"url": "https://files.pythonhosted.org/packages/a2/48/b357335c5d32cc5ed41d019514149fdfc649f2a7254a91589fc3c29ccb9d/tgapp-activitystream-0.1.1.tar.gz"
}
]
},
"urls": [
{
"comment_text": "",
"digests": {
"md5": "f63a4acd2ea4a100ac6dbe20b00c5077",
"sha256": "2c1c20449480bcce919efac77d6ec1b3ffafa6598290292fe770e5ee9a3b7531"
},
"downloads": -1,
"filename": "tgapp-activitystream-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "f63a4acd2ea4a100ac6dbe20b00c5077",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 13717,
"upload_time": "2019-06-04T07:53:45",
"url": "https://files.pythonhosted.org/packages/a2/48/b357335c5d32cc5ed41d019514149fdfc649f2a7254a91589fc3c29ccb9d/tgapp-activitystream-0.1.1.tar.gz"
}
]
}