[open-ils-commits] r1126 - in servres/trunk/conifer: syrup templates/feeds (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Dec 28 12:04:03 EST 2010
Author: gfawcett
Date: 2010-12-28 12:04:00 -0500 (Tue, 28 Dec 2010)
New Revision: 1126
Modified:
servres/trunk/conifer/syrup/models.py
servres/trunk/conifer/templates/feeds/site_atom.xml
Log:
fix problem in feeds related to URL items.
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2010-12-28 04:01:52 UTC (rev 1125)
+++ servres/trunk/conifer/syrup/models.py 2010-12-28 17:04:00 UTC (rev 1126)
@@ -343,8 +343,7 @@
# I'm not fond of this being here. I think I'll leave this and
# item_url non-implemented, and monkey-patch them in views.py.
req = get_request()
- prefix = req.META['SCRIPT_NAME']
- return '%s/site/%d/%s' % (prefix, self.id, suffix)
+ return req.build_absolute_uri('/site/%d/%s' % (self.id, suffix))
def generate_new_passkey(self):
# todo: have a pluggable passkey algorithm.
@@ -696,19 +695,18 @@
return None
else:
req = get_request()
- prefix = req.META['SCRIPT_NAME']
- return '%s/site/%d/item/%d/dl/%s' % (
- prefix, self.site_id, self.id,
- self.fileobj.name.split('/')[-1])
+ return req.build_absolute_uri(
+ '/site/%d/item/%d/dl/%s' % (
+ self.site_id, self.id,
+ self.fileobj.name.split('/')[-1]))
- def item_url(self, suffix=''):
- req = get_request()
- prefix = req.META['SCRIPT_NAME']
- if self.item_type == 'URL' and suffix == '':
+ def item_url(self, suffix='', force_local=False):
+ if self.item_type == 'URL' and suffix == '' and not force_local:
return self.url
else:
- return '%s/site/%d/item/%d/%s' % (
- prefix, self.site_id, self.id, suffix)
+ req = get_request()
+ return req.build_absolute_uri('/site/%d/item/%d/%s' % (
+ self.site_id, self.id, suffix))
def parent_url(self, suffix=''):
if self.parent_heading:
Modified: servres/trunk/conifer/templates/feeds/site_atom.xml
===================================================================
--- servres/trunk/conifer/templates/feeds/site_atom.xml 2010-12-28 04:01:52 UTC (rev 1125)
+++ servres/trunk/conifer/templates/feeds/site_atom.xml 2010-12-28 17:04:00 UTC (rev 1126)
@@ -11,10 +11,10 @@
<updated>${lastmod.strftime("%Y-%m-%dT%H:%M:%SZ")}</updated>
<entry py:for="item in items">
<title>${render_title(item)}</title>
- <link href="${root}${item.item_url(force_local_url=True)}"
+ <link href="${item.item_url(force_local=True)}"
rel="alternate"></link>
<updated>${item.last_modified.strftime("%Y-%m-%dT%H:%M:%SZ")}</updated>
- <id>${root}${item.item_url('')}</id>
+ <id>${item.item_url(force_local=True)}</id>
<summary type="html">${item.get_item_type_display()}.
<div py:if="item.item_type=='HEADING'" py:strip="True">
Contains ${len(models.Item.objects.filter(parent_heading=item))} items.
More information about the open-ils-commits
mailing list