Commit 6f0c00f3 authored by Jim Fulton's avatar Jim Fulton

Added relative keyword argument (option) to absolute URL

to get a URL relative to installation.
parent a18b4c2b
...@@ -89,8 +89,8 @@ Aqueduct database adapters, etc. ...@@ -89,8 +89,8 @@ Aqueduct database adapters, etc.
This module can also be used as a simple template for implementing new This module can also be used as a simple template for implementing new
item types. item types.
$Id: SimpleItem.py,v 1.51 1999/05/10 16:32:04 jim Exp $''' $Id: SimpleItem.py,v 1.52 1999/05/18 15:47:03 jim Exp $'''
__version__='$Revision: 1.51 $'[11:-2] __version__='$Revision: 1.52 $'[11:-2]
import regex, sys, Globals, App.Management, Acquisition import regex, sys, Globals, App.Management, Acquisition
from webdav.Resource import Resource from webdav.Resource import Resource
...@@ -290,7 +290,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs): ...@@ -290,7 +290,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs):
else: id=self.id else: id=self.id
return marshal.dumps((id,stat)) return marshal.dumps((id,stat))
def absolute_url(self): def absolute_url(self, relative=0):
"""Return an absolute url to the object. Note that the url """Return an absolute url to the object. Note that the url
will reflect the acquisition path of the object if the object will reflect the acquisition path of the object if the object
has been acquired.""" has been acquired."""
...@@ -300,7 +300,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs): ...@@ -300,7 +300,7 @@ class Item(Base, Resource, CopySource, App.Management.Tabs):
id=callable(obj.id) and obj.id() or str(obj.id) id=callable(obj.id) and obj.id() or str(obj.id)
url.append(id) url.append(id)
obj=obj.aq_parent obj=obj.aq_parent
url.append(self.aq_acquire('REQUEST').script) if not relative: url.append(self.aq_acquire('REQUEST').script)
url.reverse() url.reverse()
return join(url, '/') return join(url, '/')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment