[ckan-changes] [okfn/ckan] c8239b: [xs] Adding qualified=True to urls using h.url_for...

GitHub noreply at github.com
Fri May 4 12:49:53 UTC 2012


  Branch: refs/heads/master
  Home:   https://github.com/okfn/ckan
  Commit: c8239b42de7e4a08e946d1421e9aac2d21845e7f
      https://github.com/okfn/ckan/commit/c8239b42de7e4a08e946d1421e9aac2d21845e7f
  Author: Ross Jones <rossdjones at gmail.com>
  Date:   2012-05-04 (Fri, 04 May 2012)

  Changed paths:
    M ckan/lib/mailer.py
    M ckan/templates/package/read.html
    M ckan/templates/package/read.n3
    M ckan/templates/package/read.rdf
    M ckan/templates/package/resource_read.html
    M ckanext/organizations/templates/email/join_publisher_request.txt

  Log Message:
  -----------
  [xs] Adding qualified=True to urls using h.url_for instead of prepending with g.site_url


diff --git a/ckan/lib/mailer.py b/ckan/lib/mailer.py
index 108ba9f..57b6a7e 100644
--- a/ckan/lib/mailer.py
+++ b/ckan/lib/mailer.py
@@ -48,7 +48,7 @@ def _mail_recipient(recipient_name, recipient_email,
         log.exception(msg)
         raise MailerException(msg)
 
-def mail_recipient(recipient_name, recipient_email, subject, 
+def mail_recipient(recipient_name, recipient_email, subject,
         body, headers={}):
     return _mail_recipient(recipient_name, recipient_email,
             g.site_title, g.site_url, subject, body, headers=headers)
@@ -56,7 +56,7 @@ def mail_recipient(recipient_name, recipient_email, subject,
 def mail_user(recipient, subject, body, headers={}):
     if (recipient.email is None) or not len(recipient.email):
         raise MailerException(_("No recipient email address available!"))
-    mail_recipient(recipient.display_name, recipient.email, subject, 
+    mail_recipient(recipient.display_name, recipient.email, subject,
             body, headers=headers)
 
 
diff --git a/ckan/templates/package/read.html b/ckan/templates/package/read.html
index 0245c7c..29a0372 100644
--- a/ckan/templates/package/read.html
+++ b/ckan/templates/package/read.html
@@ -94,12 +94,12 @@
   </div>
 
   <py:def function="optional_head">
-      <link rel="alternate" type="application/rdf+xml" title="RDF/XML" href="${g.site_url + h.url_for(controller='package', action='read', id=c.pkg.id)}.rdf" />
+      <link rel="alternate" type="application/rdf+xml" title="RDF/XML" href="${ h.url_for(controller='package', action='read', id=c.pkg.id, qualified=True)}.rdf" />
   </py:def>
 
   <py:def function="optional_feed">
   <link rel="alternate" type="application/atom+xml" title="Dataset History"
-    href="${g.site_url + h.url(controller='package', action='history', id=c.pkg.name, format='atom', days=7)}" />
+    href="${h.url(controller='package', action='history', id=c.pkg.name, format='atom', days=7, qualified=True)}" />
   </py:def>
 
   <xi:include href="layout.html" />
diff --git a/ckan/templates/package/read.n3 b/ckan/templates/package/read.n3
index 911e832..7a42af6 100644
--- a/ckan/templates/package/read.n3
+++ b/ckan/templates/package/read.n3
@@ -5,7 +5,8 @@
 @prefix owl: <http://www.w3.org/2002/07/owl#> .
 @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 
-<${ g.site_url + h.url_for(controller='package',action='read',id=c.pkg_dict['name'])}>     a dcat:Dataset;
+<${ h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True)}>
+a dcat:Dataset;
      dct:description "${c.pkg_dict['notes']}";
      dct:identifier "${c.pkg_dict['name']}";
      dct:relation  [
diff --git a/ckan/templates/package/read.rdf b/ckan/templates/package/read.rdf
index 4a0d96f..0398c41 100644
--- a/ckan/templates/package/read.rdf
+++ b/ckan/templates/package/read.rdf
@@ -8,13 +8,13 @@
   xmlns:dcat="http://www.w3.org/ns/dcat#"
   xmlns:dct="http://purl.org/dc/terms/"
 >
-  <dcat:Dataset rdf:about="${ g.site_url + h.url_for(controller='package',action='read',id=c.pkg_dict['name'])}">
+  <dcat:Dataset rdf:about="${ h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True)}">
     <owl:sameAs rdf:resource="urn:uuid:${c.pkg_dict['id']}"/>
     <dct:description>${c.pkg_dict['notes']}</dct:description>
     <py:for each="tag_dict in c.pkg_dict['tags']">
         <dcat:keyword>${ tag_dict["name"] }</dcat:keyword>
     </py:for>
-    <foaf:homepage rdf:resource="${ g.site_url + h.url_for(controller='package',action='read',id=c.pkg_dict['name'])}"/>
+    <foaf:homepage rdf:resource="${ h.url_for(controller='package',action='read',id=c.pkg_dict['name'], qualified=True)}"/>
     <rdfs:label>${c.pkg_dict['name']}</rdfs:label>
 
     <dct:identifier>${c.pkg_dict['name']}</dct:identifier>
diff --git a/ckan/templates/package/resource_read.html b/ckan/templates/package/resource_read.html
index 619c636..bebe246 100644
--- a/ckan/templates/package/resource_read.html
+++ b/ckan/templates/package/resource_read.html
@@ -76,7 +76,7 @@
     </style>
     <script type="text/javascript">
       var preload_resource = ${h.literal(c.resource_json)};
-      var embedPath = "${g.site_url+h.url_for(controller='package', action='resource_embedded_dataviewer', id=c.package.id, resource_id=c.resource.id)}";
+      var embedPath = "${h.url_for(controller='package', action='resource_embedded_dataviewer', id=c.package.id, resource_id=c.resource.id, qualified=True)}";
     </script>
   </py:def>
 
diff --git a/ckanext/organizations/templates/email/join_publisher_request.txt b/ckanext/organizations/templates/email/join_publisher_request.txt
index 1c23bdf..c15b46e 100644
--- a/ckanext/organizations/templates/email/join_publisher_request.txt
+++ b/ckanext/organizations/templates/email/join_publisher_request.txt
@@ -6,7 +6,7 @@ The reason given for the request was:
 
 "$reason"
 
-Please contact the user to verify and then if you would like to add this user you can do so by visiting ${ '%s' % g.site_url }${h.url_for(controller='ckanext.organizers.controllers:OrganizationController', action='users', id=group.name) }
+Please contact the user to verify and then if you would like to add this user you can do so by visiting ${h.url_for(controller='ckanext.organizers.controllers:OrganizationController', action='users', id=group.name, qualified=True) }
 
 If you do not wish to add this user you can safely disregard this email.
 


================================================================



More information about the ckan-changes mailing list