Sebastian Wehrmann wrote:
while using the AbsoluteURL Adapter in a view,
By the way, you're using Five's AbsoluteURL adapter. (It's different
from the one in Zope 3). Also, the patch below seems to be for Five.
Would be good to mention that :).
it only returns the path
of the object, not the URL. This is because the object does not have a
request and therefore the method absolute_url() used by the adapter
cannot call the physicalPathToURL() method.
Because we always have the request object in this adapter we can call
the physicalPathToURL() method directly and convert the physical path of
the object and return it.
Here is a diff with the fix:
Index: browser/absoluteurl.py
===================================================================
--- browser/absoluteurl.py (Revision 81990)
+++ browser/absoluteurl.py (Arbeitskopie)
@@ -35,8 +35,8 @@
self.context, self.request = context, request
def __str__(self):
- context = aq_inner(self.context)
- return context.absolute_url()
+ path = self.context.getPhysicalPath()
+ return self.request.physicalPathToURL(path)
__call__ = __str__
Any comments?
Can you round up a test that demonstrates how the current implementation
fails to cover your case and how your suggestion change fixes that?
_______________________________________________
Zope-Dev maillist - Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
** No cross posts or HTML encoding! **
(Related lists -
http://mail.zope.org/mailman/listinfo/zope-announce
http://mail.zope.org/mailman/listinfo/zope )