[CMF-checkins] SVN: CMF_Extras/trunk/CMFCollector/skins/collector/ RDF support.

Tres Seaver tseaver at palladion.com
Thu Jul 2 22:59:41 EDT 2009


Log message for revision 101413:
  RDF support.

Changed:
  U   CMF_Extras/trunk/CMFCollector/skins/collector/issues_as_rdf.pt
  A   CMF_Extras/trunk/CMFCollector/skins/collector/meta_rdf.py
  A   CMF_Extras/trunk/CMFCollector/skins/collector/meta_rdf_template.pt
  U   CMF_Extras/trunk/CMFCollector/skins/collector/query_rdf.py

-=-
Modified: CMF_Extras/trunk/CMFCollector/skins/collector/issues_as_rdf.pt
===================================================================
--- CMF_Extras/trunk/CMFCollector/skins/collector/issues_as_rdf.pt	2009-07-03 02:58:56 UTC (rev 101412)
+++ CMF_Extras/trunk/CMFCollector/skins/collector/issues_as_rdf.pt	2009-07-03 02:59:40 UTC (rev 101413)
@@ -5,57 +5,7 @@
     xmlns:dc="http://purl.org/dc/elements/1.1/#"
     xmlns:collector="http://namespaces.zope.org/cmfcollector#">
  <rdf:Seq about="#"
-          tal:attributes="about string:${context/absolute_url}/supporters">
-  <rdf:li tal:repeat="item options/supporters">
-   <rdf:Description
-      about="#"
-      tal:attributes="about string:${context/absolute_url}/supporters/${item}">
-    <collector:supporter tal:content="item">SUPPORTER</collector:supporter>
-   </rdf:Description>
-  </rdf:li>
- </rdf:Seq>
- <rdf:Seq about="#"
-          tal:attributes="about string:${context/absolute_url}/status">
-  <rdf:li tal:repeat="item options/status">
-   <rdf:Description
-      about="#"
-      tal:attributes="about string:${context/absolute_url}/status/${item}">
-    <collector:status tal:content="item">STATUS</collector:status>
-   </rdf:Description>
-  </rdf:li>
- </rdf:Seq>
- <rdf:Seq about="#"
-          tal:attributes="about string:${context/absolute_url}/topic">
-  <rdf:li tal:repeat="item options/topic">
-   <rdf:Description
-      about="#"
-      tal:attributes="about string:${context/absolute_url}/topic/${item}">
-    <collector:topic tal:content="item">TOPIC</collector:topic>
-   </rdf:Description>
-  </rdf:li>
- </rdf:Seq>
- <rdf:Seq about="#"
-          tal:attributes="about string:${context/absolute_url}/classification">
-  <rdf:li tal:repeat="item options/classification">
-   <rdf:Description
-      about="#"
-      tal:attributes="about string:${context/absolute_url}/classification/${item}">
-    <collector:classification tal:content="item">CLASSIFICATION</collector:classification>
-   </rdf:Description>
-  </rdf:li>
- </rdf:Seq>
- <rdf:Seq about="#"
-          tal:attributes="about string:${context/absolute_url}/importance">
-  <rdf:li tal:repeat="item options/importance">
-   <rdf:Description
-      about="#"
-      tal:attributes="about string:${context/absolute_url}/importance/${item}">
-    <collector:importance tal:content="item">IMPORTANCE</collector:importance>
-   </rdf:Description>
-  </rdf:li>
- </rdf:Seq>
- <rdf:Seq about="#"
-          tal:attributes="about string:${context/absolute_url}/items">
+          tal:attributes="about string:${options/collector_url}/items">
   <rdf:li tal:repeat="item options/issues">
    <rdf:Description about="#"
                     tal:attributes="about item/url">

Added: CMF_Extras/trunk/CMFCollector/skins/collector/meta_rdf.py
===================================================================
--- CMF_Extras/trunk/CMFCollector/skins/collector/meta_rdf.py	                        (rev 0)
+++ CMF_Extras/trunk/CMFCollector/skins/collector/meta_rdf.py	2009-07-03 02:59:40 UTC (rev 101413)
@@ -0,0 +1,16 @@
+##Script (Python) "meta_rdf"
+##Title: Return collector metadata as RDF
+##parameters=REQUEST
+
+REQUEST.RESPONSE.setHeader('Content-Type', 'application/xml')
+catalog = context.get_internal_catalog()
+
+options = {'collector_url': context.absolute_url(),
+           'status': catalog.uniqueValuesFor('status'),
+           'supporters': context.supporters,
+           'topic': context.topics,
+           'classification': context.classifications,
+           'importance': context.importances,
+          }
+
+return context.meta_rdf_template(**options)

Added: CMF_Extras/trunk/CMFCollector/skins/collector/meta_rdf_template.pt
===================================================================
--- CMF_Extras/trunk/CMFCollector/skins/collector/meta_rdf_template.pt	                        (rev 0)
+++ CMF_Extras/trunk/CMFCollector/skins/collector/meta_rdf_template.pt	2009-07-03 02:59:40 UTC (rev 101413)
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<rdf:RDF
+    xmlns:tal="http://xml.zope.org/namespaces/tal"
+    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+    xmlns:dc="http://purl.org/dc/elements/1.1/#"
+    xmlns:collector="http://namespaces.zope.org/cmfcollector#">
+ <rdf:Seq about="#"
+          tal:attributes="about string:${options/collector_url}/supporters">
+  <rdf:li tal:repeat="item options/supporters">
+   <rdf:Description
+      about="#"
+      tal:attributes="about string:${options/collector_url}/supporters/${item}">
+    <collector:supporter tal:content="item">SUPPORTER</collector:supporter>
+   </rdf:Description>
+  </rdf:li>
+ </rdf:Seq>
+ <rdf:Seq about="#"
+          tal:attributes="about string:${options/collector_url}/status">
+  <rdf:li tal:repeat="item options/status">
+   <rdf:Description
+      about="#"
+      tal:attributes="about string:${options/collector_url}/status/${item}">
+    <collector:status tal:content="item">STATUS</collector:status>
+   </rdf:Description>
+  </rdf:li>
+ </rdf:Seq>
+ <rdf:Seq about="#"
+          tal:attributes="about string:${options/collector_url}/topic">
+  <rdf:li tal:repeat="item options/topic">
+   <rdf:Description
+      about="#"
+      tal:attributes="about string:${options/collector_url}/topic/${item}">
+    <collector:topic tal:content="item">TOPIC</collector:topic>
+   </rdf:Description>
+  </rdf:li>
+ </rdf:Seq>
+ <rdf:Seq about="#"
+          tal:attributes="about string:${options/collector_url}/classification">
+  <rdf:li tal:repeat="item options/classification">
+   <rdf:Description
+      about="#"
+      tal:attributes="about string:${options/collector_url}/classification/${item}">
+    <collector:classification tal:content="item">CLASSIFICATION</collector:classification>
+   </rdf:Description>
+  </rdf:li>
+ </rdf:Seq>
+ <rdf:Seq about="#"
+          tal:attributes="about string:${options/collector_url}/importance">
+  <rdf:li tal:repeat="item options/importance">
+   <rdf:Description
+      about="#"
+      tal:attributes="about string:${options/collector_url}/importance/${item}">
+    <collector:importance tal:content="item">IMPORTANCE</collector:importance>
+   </rdf:Description>
+  </rdf:li>
+ </rdf:Seq>
+</rdf:RDF>

Modified: CMF_Extras/trunk/CMFCollector/skins/collector/query_rdf.py
===================================================================
--- CMF_Extras/trunk/CMFCollector/skins/collector/query_rdf.py	2009-07-03 02:58:56 UTC (rev 101412)
+++ CMF_Extras/trunk/CMFCollector/skins/collector/query_rdf.py	2009-07-03 02:59:40 UTC (rev 101413)
@@ -6,8 +6,6 @@
 
 kw = REQUEST.form
 
-options = {}
-
 query = kw.copy()
 query['portal_type'] = 'Collector Issue'
 
@@ -41,12 +39,8 @@
            }
     items.append(info)
 
-options['issues'] = tuple(items)
+options = {'collector_url': context.absolute_url(),
+           'issues': tuple(items),
+          }
 
-options['supporters'] = catalog.supporters
-options['status'] = catalog.uniqueValuesFor('status')
-options['topic'] = catalog.topics
-options['classification'] = catalog.classifications
-options['importance'] = catalog.importances
-
 return context.issues_as_rdf(**options)



More information about the CMF-checkins mailing list