Problems with absolute_url in my product
Zalutations! I'm running in to a problem here that probably has a simple answer: I have a class that extends ObjectManager, and that class has another ObjectManager attribute called 'data', like this: class MyChildClass( ObjectManager.ObjectManager ): def __init__(self,id): self.id = id class MyZopeClass( ObjectManager.ObjectManager ): def __init__(self): self._setObject('data', MyChildClass('data')) I have all of the add forms and constructors in place, and I can add instances of "MyZopeClass" using the ZMI. If I add one of these instances to my root folder as 'myzopeclass' then I can go to http://me:8080/myzopeclass and it just throws up the index_html from the root folder because I don't have anything defined there... But I wrote a small dtml method to show the absolute_url value for an object, and when I go to http://me:8080/myzopeclass/abs it doesn't show the correct absolute URL. (This is what is in the 'abs' dtml method) "<dtml-var absolute_url>" (that's it) Going to http://me:8080/abs gives http://me:8080/ as you would hope. Going to http://me:8080/myzopeclass/abs gives http://me:8080/ again, but that's not what I expected Going to http://me:8080/myzopeclass/data/abs gives http://me:8080// which is odd too. Is there something I'm missing that is causing the acquisition or something else to break? TIA -Paul _________________________________________________________________ Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
Paul Tiemann writes:
... I have a class that extends ObjectManager, and that class has another ObjectManager attribute called 'data', like this:
class MyChildClass( ObjectManager.ObjectManager ): def __init__(self,id): self.id = id ... But I wrote a small dtml method ("abs") to show the absolute_url value for an object ... "<dtml-var absolute_url>" ... http://me:8080/myzopeclass/abs it doesn't show the correct absolute URL. ... Going to http://me:8080/myzopeclass/abs gives http://me:8080/ again, but that's not what I expected You are sure, "abs" is a DTML Method and not a DTML Document?
"absolute_url" is defined by the mixin class "Traversable". It should be a superclass of "ObjectManager". If it were not, then what you see would be understandable: "absolute_url" would be acquired from the containing folder. Another potential problem might be that your class does not define "getId". The result should not be as you describe, though. You should get the last path segment repeated several times. Dieter
participants (2)
-
Dieter Maurer -
Paul Tiemann