Well, adding a random variable to a URL may seem terrible, but it's the _only_ way I know of to make IE behave(lest I start running .NET and IIS servers).
The main point is that the random variable has to be evaluated in the std.url call.

regards

/rune

On 7. des. 2005, at 14.42, Kevin Dangoor wrote:


If we were adding something for this explicit purpose, I'd prefer to
add a flag to the url function and then have TurboGears eat the
incoming "tg_random" variable so that you don't need to add another
parameter to your methods.

In some ways, it seems like doing a POST would be nicer than adding a
random hash. I did see Bob call that absolutely terrible, but adding a
random value to a URL seems unpleasant as well.

Kevin

On 12/7/05, Rune Hansen <[EMAIL PROTECTED]> wrote:
I'd like to include a new variable in stdvars -> hash_random

Why, because of IE's caching of GET requests. This is particularly annoying
when working with XMLHttpRequests.

With a hash_random variable you can construct URLs with std.url like this:
<a href=""margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">(Yes, this can also be solved , rather awkwardly, with _javascript_)

def hash_random(seed=None):
    _r = random.Random(seed)
    return md5.new(str(time.time()*_r.random())).hexdigest()

I haven't given much thought on just how "random" this random generator is,
but it should be more than good enough for this particular use.

"""
view.py

import md5
import random
215a217,220

def hash_random(seed=None):
    _r = random.Random(seed)
    return md5.new(str(_r.random())).hexdigest()
255c260,261
<         locale = get_locale())
---
        locale = get_locale(),
        hash=hash_random)
"""

regards
/rune



---------------------------------------------------------------------

Behind the firewall, nobody can hear you scream...



--
Kevin Dangoor
Author of the Zesty News RSS newsreader


---------------------------------------------------------------------

Behind the firewall, nobody can hear you scream...


Reply via email to