[Zope] Impossibly long urls
Chris Withers
chrisw@nipltd.com
Wed, 31 Jul 2002 10:03:22 +0100
David Beech wrote:
> Hello folks,
>
> The saga continues ...
>
>>From a Python script I use a return statement like:
>
> return container.xxx.yyy.zzz.aaa(container.REQUEST)
>
> aaa is a dtml doc and the REQUEST object has had some attributes
> set that aaa will use. aaa is nested down in the tree xxx.yyy.zzz
>
> The result of this is that it seems that Zope appends the return
> value to the calling URL, hence it gets longer and longer and
> when returned Zope does things I rather it didn't, like
> rerunning SQL methods.
The above will return the result of rendering aaa, is that what you want?
> If I apply absolute_url to this as in:
>
> return container.xxx.yyy.zzz.aaa.absolute_url()
>
> I get a string returned not a renderable object.
Well indeed, what were you expecting? Actually, your first example returns a
string too, just a long one with lots of HTML in it ;-)
> I try another strategy and do
>
> return context.xxx.yyy.zzz.absolute_url() + '/aaa'
>
> expecting to force a redirect but it fails. Deep sighs.
Why? You're just returning a very short string there, one which you'e appended
'/aaa' to.
If you want to redirect, you'd do:
return context.REQUEST.RESPONSE.redirect(container.xxx.yyy.zzz.aaa.absolute_url())
...but I don't think you do, since you're loose your current REQUEST object when
you do that.
> I want to return object references from Python scripts as
> absolute urls
Object references and absolute URLs are two very different things.
What is it that you're trying to do? (high level, don't explain how you're
trying to solve the problem which is somethign altogether different ;-)
cheers,
Chris