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="${std.url('/Edit',tg_format='json',rand=std.hash())}>LINK</a>
> (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
email: [EMAIL PROTECTED]
company: http://www.BlazingThings.com
blog: http://www.BlueSkyOnMars.com