You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by tv...@apache.org on 2013/11/19 23:15:27 UTC

git commit: [#6828] Changes related to activitystream refactor

Updated Branches:
  refs/heads/tv/6828 [created] fec9d4d0d


[#6828] Changes related to activitystream refactor

- Activities are proper objects now, not dicts
- Specify Ming as default storage driver in setup.py
- Configure activitystream for tests

Signed-off-by: Tim Van Steenburgh <tv...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/fec9d4d0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/fec9d4d0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/fec9d4d0

Branch: refs/heads/tv/6828
Commit: fec9d4d0d54b57d941d71ac525712ca31480adb9
Parents: 6897c23
Author: Tim Van Steenburgh <tv...@gmail.com>
Authored: Tue Nov 19 22:15:05 2013 +0000
Committer: Tim Van Steenburgh <tv...@gmail.com>
Committed: Tue Nov 19 22:15:05 2013 +0000

----------------------------------------------------------------------
 Allura/allura/model/timeline.py                  | 2 +-
 Allura/allura/websetup/schema.py                 | 3 +++
 Allura/setup.py                                  | 2 ++
 Allura/test.ini                                  | 1 +
 ForgeActivity/forgeactivity/templates/index.html | 6 +++---
 5 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fec9d4d0/Allura/allura/model/timeline.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/timeline.py b/Allura/allura/model/timeline.py
index 90c918d..38550b8 100644
--- a/Allura/allura/model/timeline.py
+++ b/Allura/allura/model/timeline.py
@@ -63,7 +63,7 @@ def perm_check(user):
         """Return True if c.user has 'read' access to this activity,
         otherwise return False.
         """
-        extras_dict = activity['obj'].get('activity_extras')
+        extras_dict = activity.obj.activity_extras
         if not extras_dict: return True
         allura_id = extras_dict.get('allura_id')
         if not allura_id: return True

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fec9d4d0/Allura/allura/websetup/schema.py
----------------------------------------------------------------------
diff --git a/Allura/allura/websetup/schema.py b/Allura/allura/websetup/schema.py
index 320c454..0198f8a 100644
--- a/Allura/allura/websetup/schema.py
+++ b/Allura/allura/websetup/schema.py
@@ -20,6 +20,8 @@
 """Setup the allura application"""
 
 import logging
+
+import activitystream
 from tg import config
 import pylons
 from paste.registry import Registry
@@ -37,6 +39,7 @@ def setup_schema(command, conf, vars):
     REGISTRY.register(pylons.app_globals, config['pylons.app_globals'])
     REGISTRY.register(allura.credentials, allura.lib.security.Credentials())
     ming.configure(**conf)
+    activitystream.configure(**conf)
     # Nothing to do
     log.info('setup_schema called')
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fec9d4d0/Allura/setup.py
----------------------------------------------------------------------
diff --git a/Allura/setup.py b/Allura/setup.py
index 32e6eb4..bc829ce 100644
--- a/Allura/setup.py
+++ b/Allura/setup.py
@@ -146,5 +146,7 @@ setup(
     [easy_widgets.engines]
     jinja = allura.config.app_cfg:JinjaEngine
 
+    [activitystream.storage]
+    driver = activitystream.storage.mingstorage:MingStorage
     """,
 )

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fec9d4d0/Allura/test.ini
----------------------------------------------------------------------
diff --git a/Allura/test.ini b/Allura/test.ini
index 8747433..99ca324 100644
--- a/Allura/test.ini
+++ b/Allura/test.ini
@@ -52,6 +52,7 @@ activitystream.database = activitystream
 activitystream.activity_collection = activities
 activitystream.node_collection = nodes
 activitystream.timeline_collection = timelines
+activitystream.recording.enabled = true
 activitystream.enabled = true
 
 solr.mock = true

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/fec9d4d0/ForgeActivity/forgeactivity/templates/index.html
----------------------------------------------------------------------
diff --git a/ForgeActivity/forgeactivity/templates/index.html b/ForgeActivity/forgeactivity/templates/index.html
index e4ad26a..6189688 100644
--- a/ForgeActivity/forgeactivity/templates/index.html
+++ b/ForgeActivity/forgeactivity/templates/index.html
@@ -37,7 +37,7 @@
 {% endblock %}
 
 {% macro activity_obj(o) %}
-  <a href="{{o['activity_url']}}">{{o['activity_name']}}</a>
+  <a href="{{o.activity_url}}">{{o.activity_name}}</a>
 {% endmacro %}
 
 {% block content %}
@@ -47,8 +47,8 @@
   {% else %}
     <ul>
         {% for a in timeline %}
-        <li>{{activity_obj(a['actor'])}} {{a['verb']}} {{activity_obj(a['obj'])}} {% if a.get('target') %}on {{activity_obj(a['target'])}}{% endif %} {{h.ago(a['published'])}}</li>
-        <!-- Score: {{ a.get('score') }} -->
+        <li>{{activity_obj(a.actor)}} {{a.verb}} {{activity_obj(a.obj)}} {% if a.target.activity_name %}on {{activity_obj(a.target)}}{% endif %} {{h.ago(a.published)}}</li>
+        <!-- Score: {{ a.score }} -->
         {% endfor %}
     </ul>
   {% endif %}