allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [25/50] git commit: [#7208] ticket:549 Add extension points for apps
Date Tue, 25 Mar 2014 14:27:23 GMT
[#7208] ticket:549 Add extension points for apps


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

Branch: refs/heads/db/5995
Commit: 19cbbfa4763ff67995b1c89759827ead8ee6cc62
Parents: f92fa76
Author: Igor Bondarenko <jetmind2@gmail.com>
Authored: Wed Feb 26 13:05:15 2014 +0200
Committer: Cory Johns <cjohns@slashdotmedia.com>
Committed: Wed Mar 12 20:47:54 2014 +0000

----------------------------------------------------------------------
 Allura/allura/app.py           | 17 +++++++++++++++++
 Allura/allura/model/project.py | 10 ++++++++++
 2 files changed, 27 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/19cbbfa4/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index 7746bc9..f95e5f9 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -29,6 +29,7 @@ from paste.deploy.converters import asbool, asint
 from bson import ObjectId
 from bson.errors import InvalidId
 from formencode import validators as V
+from datatree import Node
 
 from ming.orm import session
 from ming.utils import LazyProperty
@@ -623,6 +624,22 @@ class Application(object):
         """
         raise NotImplementedError, 'bulk_export'
 
+    def doap(self):
+        """App's representation for DOAP API.
+
+        :rtype: datatree.Node
+        """
+        app = Node('sf:Feature')
+        app << Node('name', self.config.options.mount_label)
+        app << Node('foaf:page', **{'rdf:resource': h.absurl(self.url)})
+        return Node('sf:feature') << app
+
+    def additional_doap_entries(self):
+        """Additional DOAP entries to include in project's DOAP represention.
+
+        :rtype: list of datatree.Node
+        """
+        return []
 
 class DefaultAdminController(BaseController):
 

http://git-wip-us.apache.org/repos/asf/allura/blob/19cbbfa4/Allura/allura/model/project.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/project.py b/Allura/allura/model/project.py
index a5a7816..a4883ed 100644
--- a/Allura/allura/model/project.py
+++ b/Allura/allura/model/project.py
@@ -1010,6 +1010,12 @@ class Project(MappedClass, ActivityNode, ActivityObject):
         if self.external_homepage:
             p << Node('homepage', **{'rdf:resource': self.external_homepage})
 
+        # Additional entries provided by tools
+        apps = [self.app_instance(ac) for ac in self.app_configs if h.has_access(ac, 'read')]
+        for app in apps:
+            for entry in app.additional_doap_entries():
+                p << entry
+
         # Categories
         for cat in TroveCategory.query.find({'_id': {'$in': self.trove_audience}}):
             p << Node('audience', cat.fullname)
@@ -1065,6 +1071,10 @@ class Project(MappedClass, ActivityNode, ActivityObject):
             person << Node('foaf:homepage', **{'rdf:resource': h.absurl(u.url())})
             p << (Node('developer') << person)
 
+        # Basic tool info
+        for app in apps:
+            p << app.doap()
+
         return root.render(as_root=True)
 
 


Mime
View raw message