You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by st...@apache.org on 2013/03/03 10:31:06 UTC
git commit: [#5453] Setting userstats tool as anchored for user
projects
Updated Branches:
refs/heads/si/5453 5fdd681b0 -> 0ba3e4a6b
[#5453] Setting userstats tool as anchored for user projects
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/0ba3e4a6
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/0ba3e4a6
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/0ba3e4a6
Branch: refs/heads/si/5453
Commit: 0ba3e4a6b99d5b0f188d536dc652f596c5528b92
Parents: 5fdd681
Author: Stefano Invernizzi <st...@apache.org>
Authored: Sun Mar 3 10:30:05 2013 +0100
Committer: Stefano Invernizzi <st...@apache.org>
Committed: Sun Mar 3 10:30:05 2013 +0100
----------------------------------------------------------------------
Allura/allura/lib/app_globals.py | 4 +---
Allura/allura/model/auth.py | 6 ++++--
Allura/allura/model/project.py | 2 --
Allura/allura/websetup/bootstrap.py | 1 +
Allura/development.ini | 6 ------
ForgeUserStats/test.ini | 1 -
6 files changed, 6 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0ba3e4a6/Allura/allura/lib/app_globals.py
----------------------------------------------------------------------
diff --git a/Allura/allura/lib/app_globals.py b/Allura/allura/lib/app_globals.py
index ee2c9b9..1ab9b31 100644
--- a/Allura/allura/lib/app_globals.py
+++ b/Allura/allura/lib/app_globals.py
@@ -172,12 +172,10 @@ class Globals(object):
# Zarkov logger
self._zarkov = None
- self.show_userstats = config.get('userstats.enable','false')=='true'
# Set listeners to update stats
statslisteners = []
for name, ep in self.entry_points['stats'].iteritems():
- if config.get('%s.enable' % name,'false')=='true':
- statslisteners.append(ep())
+ statslisteners.append(ep())
self.statsUpdater = PostEvent(statslisteners)
@LazyProperty
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0ba3e4a6/Allura/allura/model/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/auth.py b/Allura/allura/model/auth.py
index 23f5366..a0bdb20 100644
--- a/Allura/allura/model/auth.py
+++ b/Allura/allura/model/auth.py
@@ -341,9 +341,11 @@ class User(MappedClass, ActivityNode, ActivityObject):
@property
def stats(self):
- if g.show_userstats:
+ if 'userstats' in g.entry_points['stats']:
from forgeuserstats.model.stats import UserStats
- return UserStats.query.get(_id=self.stats_id)
+ if self.stats_id:
+ return UserStats.query.get(_id=self.stats_id)
+ return UserStats.create(self)
else:
return None
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0ba3e4a6/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index da821ad..93f8257 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -714,8 +714,6 @@ class Project(MappedClass, ActivityNode, ActivityObject):
('admin', 'admin', 'Admin'),
('search', 'search', 'Search'),
('activity', 'activity', 'Activity')]
- if g.show_userstats:
- apps = apps + [('userstats', 'userstats', 'Statistics')]
else:
apps = [('admin', 'admin', 'Admin'),
('search', 'search', 'Search'),
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0ba3e4a6/Allura/allura/websetup/bootstrap.py
----------------------------------------------------------------------
diff --git a/Allura/allura/websetup/bootstrap.py b/Allura/allura/websetup/bootstrap.py
index 9614b99..747504c 100644
--- a/Allura/allura/websetup/bootstrap.py
+++ b/Allura/allura/websetup/bootstrap.py
@@ -88,6 +88,7 @@ def bootstrap(command, conf, vars):
google_analytics = False))
n_users = M.Neighborhood(name='Users', url_prefix='/u/',
shortname_prefix='u/',
+ anchored_tools='userstats:Statistics',
features=dict(private_projects = True,
max_projects = None,
css = 'none',
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0ba3e4a6/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 6d88b95..ae550ae 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -123,12 +123,6 @@ scm.repos.root = /tmp
trovecategories.enableediting = true
-# If set to false, the stats of the user are not
-# updated and they are not shown to users.
-# Note: the name of the parameter has to be the same
-# of the entry point, followed by .enable
-userstats.enable = true
-
# ActivityStream
activitystream.master = mongodb://127.0.0.1:27017
activitystream.database = activitystream
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/0ba3e4a6/ForgeUserStats/test.ini
----------------------------------------------------------------------
diff --git a/ForgeUserStats/test.ini b/ForgeUserStats/test.ini
index 04c1c6e..6753aa4 100644
--- a/ForgeUserStats/test.ini
+++ b/ForgeUserStats/test.ini
@@ -5,7 +5,6 @@
#
[DEFAULT]
debug = true
-userstats.enable = true
[server:main]
use = egg:Paste#http